<template>
	<view style="height: 100%;">
		<view class="column-css" style="height: 100%;">
			<!-- <view class="row-css" style="align-items: center;padding: 20rpx;background: #FFFFFF;" @click="onCarrier">
				<image style="width: 20rpx;height: 21rpx;padding-right: 10rpx;" mode="aspectFit" src="../../static/icon_carrier.png"></image>
				{{ etpName }}
				<view v-if="count != 0" style="border-radius: 50%;width: 30rpx;height: 30rpx;line-height: 30rpx;text-align: center;color: #FFFFFF; background: #F36363;">
					{{ count }}
				</view>
			</view>
			<view style="padding: 20rpx;">进行中的任务</view> -->
			<view class="column-css" v-if="tasklist.length != 0">
				<mescroll-body ref="mescroll" @init="mescrollInit" @down="downCallback" @up="upCallback"
					:down="downOption" :up="upOption">
					<view class="column-css">
						<view class="row-css" style="align-items: center;padding: 20rpx;background: #FFFFFF;justify-content:space-between"
							>
							<view class="" @click="onCarrier">
								<image style="width: 20rpx;height: 21rpx;padding-right: 10rpx;" mode="aspectFit"
									src="../../static/icon_carrier.png"></image>
								{{ etpName }}
								<view v-if="count != 0"
									style="border-radius: 50%;width: 30rpx;height: 30rpx;line-height: 30rpx;text-align: center;color: #FFFFFF; background: #F36363;">
									{{ count }}
								</view>
							</view>
							<view class="messagetips" @click.stop="jumpMessage()">
								<image style="width: 20rpx;height: 21rpx;padding-right: 10rpx;" mode="aspectFit" src="../../static/tips.png"></image>
								<text :class="messagetips?'tipstext':''" v-if="messagetips ">{{messagetips}}</text>
								<text :class="messagetips?'tipstext':''" v-if="!messagetips && buesinessNum"></text>
							</view>
						</view>
						<view style="padding: 20rpx;">进行中的任务</view>
						<block v-for="(item, index) in tasklist" :key="index">
							<view style="border-radius: 10rpx;background: #FFFFFF;margin: 10rpx;">
								<view class="row-css" style="padding: 20rpx 10rpx;" @click="onDetail(item)">
									{{ item.billNo }}
									<view v-if="item.custNo != ''" style="width: 40rpx;height: 40rpx;margin: 0 10rpx;"
										@click.stop="onfav(item)">
										<image style="width: 40rpx;height: 40rpx;" mode="scaleToFill"
											src="../../static/icon_customer.png"></image>
										<view v-if="item.iscustNo ==1" class="row-css"
											style="position: relative;top: -110rpx;left: -300rpx;white-space: nowrap;">
											<text
												style="background: #000000;opacity: 0.5; padding: 10rpx 15rpx;color: #ffffff;">客户单号:
												{{ item.custNo }}</text></view>
									</view>
									| {{ item.vehicleNo }}
									{{ item.shippingPrice ?(' | '+ item.shippingPrice + '元/'+  item.unitStr):''}}
								</view>
								<view @click="onDetail(item)">
									<uni-steps v-if="item.checkinList.length > 0" style="padding-top: 40rpx;"
										activeColor="#2979FF" :options="item.checkinList"
										:active="item.checkinSeq - 1"></uni-steps>
								</view>
								<view class="column-css"
									style="margin: 10rpx;border-radius: 10rpx;background: #F7F7F7;padding: 20rpx;"
									@click="onDetail(item)">
									<view class="row-css" style="align-items: center;">
										<view class="view-rodio" style="background: #C8E9CA;">
											<view class="view-rodio-ativc" style="background: #81D588;"></view>
										</view>
										{{ item.shippingCity }}
									</view>
									<view style="display: flex; align-items: center;font-size: 24rpx;">
										<image style="width: 20rpx;height: 21rpx;padding: 30rpx 0;margin: 0 5rpx;"
											mode="aspectFit" src="../../static/icon_carrier_h.png"></image> 
											<text style="padding-left: 12rpx;" v-show="item.distance"> {{item.distance}}Km</text>
									</view>
									<view class="row-css" style="align-items: center;">
										<view class="view-rodio" style="background: #F8C9AA;">
											<view class="view-rodio-ativc" style="background: #FB8536;"></view>
										</view>
										{{ item.receiptCity }}
									</view>
								</view>
								<view class="row-css"
									style="text-align: right;margin: 30rpx 10rpx;padding-bottom: 30rpx;">
									<view v-if="item.billStatus == 2 && item.nextCheckinNodeName != ''"
										class="view-deltail"
										style="width: 30%;margin-right: 12rpx;background: #FFFFFF;border: 1rpx solid #2B7CFF;color: #2B7CFF;"
										@click="onReport(item)">
										异常上报
									</view>
									<!-- <view
										class="view-deltail"
										style="flex: 2;background: #FFFFFF;margin: 0 5rpx;border: 1rpx solid #2B7CFF;color: #2B7CFF;"
										@click="onDetail(item)"
									>
										查看详情
									</view> -->
									<view v-if="item.billStatus == 1" class="view-deltail"
										style="flex: 1;background: #1aad19;" @click="onOrders(item)">接单</view>
									<view v-if="item.nextCheckinNodeName != '' && item.billStatus == 2"
										class="view-deltail" style="flex: 1;"
										:style="{background: item.nextCheckinNodeName == '起运' ? '#2B7CFF' : item.nextCheckinNodeName == '到达' ? '#FB8536' : '#00bfbf'}"
										@click="onAuthorize(item)">
										<image v-if="item.nextCheckinNodeName == '起运'" style="width: 44rpx;height: 44rpx;padding-right: 10rpx;vertical-align: middle" mode="aspectFit" src="../../static/xiehuo.png"></image>
										<image v-if="item.nextCheckinNodeName == '到达'" style="width: 44rpx;height: 44rpx;padding-right: 10rpx;vertical-align: middle" mode="aspectFit" src="../../static/huo.png"></image>
										{{ item.nextCheckinNodeName == '起运'?'装载起运':item.nextCheckinNodeName == '到达'?'卸货到达':item.nextCheckinNodeName }}
									</view>
									<view v-if="item.nextCheckinNodeName != '' && item.billStatus == 5"
										class="view-deltail" style="flex: 1;background: #b9b9b9;">
										取消申请中
									</view>
									<view v-if="item.nextCheckinNodeName != '' && item.billStatus == 6"
										class="view-deltail" style="flex: 1;background: #b9b9b9;">
										已取消
									</view>
									<view style="width: 100%;    display: flex;" v-if="item.billStatus == 7">
										<view v-if="item.beforeCancelStatus == 2 && item.nextCheckinNodeName != ''"
											class="view-deltail"
											style="width: 30%;margin-right: 12rpx;background: #FFFFFF;border: 1rpx solid #2B7CFF;color: #2B7CFF;"
											@click="onReport(item)">
											异常上报
										</view>
										<view v-if="item.beforeCancelStatus == 1" class="view-deltail"
											style="flex: 1;background: #FB8536;" @click="onOrders(item)">接单</view>
										<view v-if="item.nextCheckinNodeName != '' && item.beforeCancelStatus == 2"
											class="view-deltail" style="flex: 1;background: #FB8536;"
											@click="onAuthorize(item)">
											{{ item.nextCheckinNodeName }}
										</view>
										<view v-if="item.nextCheckinNodeName != '' && item.beforeCancelStatus == 5"
											class="view-deltail" style="flex: 1;background: #b9b9b9;">
											取消申请中
										</view>
										<view v-if="item.nextCheckinNodeName != '' && item.beforeCancelStatus == 6"
											class="view-deltail" style="flex: 1;background: #b9b9b9;">
											已取消
										</view>
									</view>
									<view v-if="item.billStatus == 8"
										class="view-deltail"
										style="width: 30%;margin-right: 12rpx;background: #FFFFFF;border: 1rpx solid #FB8536;color: #FB8536;"
										@click="operateLoadingOrder(3,item)" >
										驳回
									</view>
									<view  v-if="item.billStatus == 8"	class="view-deltail"
										style="flex: 1;background: #FB8536;" @click="operateLoadingOrder(4,item)" >
										确认作废
									</view>
								</view>
							</view>
						</block>
					</view>
				</mescroll-body>
			</view>
			<view v-else class="column-css" style="height: 100%;">
				<view class="row-css" style="align-items: center;padding: 20rpx;background: #FFFFFF;justify-content:space-between"
					>
					<view @click="onCarrier" v-if="userInfo.mobile">
						<image style="width: 20rpx;height: 21rpx;padding-right: 10rpx;" mode="aspectFit"
							src="../../static/icon_carrier.png"></image>
						{{ etpName }}
						<view v-if="count != 0"
							style="border-radius: 50%;width: 30rpx;height: 30rpx;line-height: 30rpx;text-align: center;color: #FFFFFF; background: #F36363;">
							{{ count }}
						</view>
					</view>
					<view class="messagetips" @click.stop="jumpMessage()" v-if="userInfo.mobile">
						<image style="width: 20rpx;height: 21rpx;padding-right: 10rpx;" mode="aspectFit" src="../../static/tips.png"></image>
						<text :class="messagetips?'tipstext':''"  v-if="messagetips">{{messagetips}}</text>
						<text :class="messagetips?'tipstext':''"   v-if="!messagetips && buesinessNum"></text>
					</view>
				</view>
				<view style="padding: 20rpx;">进行中的任务</view>
				<view class="column-css" style="align-items: center; background: #FFFFFF;height: 100%;">
					<view style="margin-top: 50rpx;">
						<image mode="aspectFit" src="../../static/icon_supply_img.png"></image>
					</view>
					<view style="margin: 10rpx 0;" v-if="userInfo.mobile">当前暂无配载单</view>
					<view style="color: #2B7CFF;" @click="onHistoricalwaybill" v-if="userInfo.mobile">查看我做过的任务>></view>
					<view v-if="!userInfo.mobile">登录后查看进行中的任务</view>
					<view style="margin: 40rpx 150rpx;" @click="onLogin()" v-if="!userInfo.mobile">
						<button style="background: #007AFF;font-size: 16px;width: 100px;" type="primary">
							去登录
						</button>
					</view>
				</view>
			</view>
		</view>
		<!-- <view v-else class="column-css"
			style="justify-content: center;text-align: center;height: 100%;background: #FFFFFF;">
			<view style="margin: 0 150rpx;" @click="onLogin()"><button style="background: #007AFF;" type="primary">注册 /
					登录</button></view>
			<view style="color: #2B7CFF;font-size: 24rpx;margin: 40rpx auto;" @click="goBackAccount">
				如原手机号无法使用，请点击找回账号
			</view>
		</view> -->
		<view class="column-css" style="position: fixed;bottom: 80rpx;right: 80rpx;justify-content: center;" >
			<view class="" @click="jumpdaiban('daiban')" v-if="daibanNum">
				<view style="width: 92rpx;height: 92rpx;border: 8rpx solid #FFFFFF;box-shadow: 1px 3px 14px #b3b1b1;color: #FFFFFF;position: relative; padding: 10rpx;background: #ff0808; border-radius: 50%;">
					<view style="position: absolute; top: -5rpx; right: 0;color: #FFFFFF;background: #d20606;padding: 0 6rpx;border-radius: 12rpx;">
						{{ daibanNum }}
					</view>
					<view style="text-align: center;font-size: 36rpx;font-weight: 700;">
					!
					</view>
				<!-- <image style="width: 60rpx;height: 60rpx;margin: 20rpx;" mode="aspectFit" src="../../static/icon_scan.png"></image> -->
					<view style="text-align: center;">待办</view>
				</view>
				
			</view>
			<view class="" @click="onscan">
				<view style="width: 100rpx;height: 100rpx;padding: 10rpx;background: #FFFFFF; border-radius: 50%;">
					<image style="width: 60rpx;height: 60rpx;margin: 20rpx;" mode="aspectFit" src="../../static/icon_scan.png"></image>
				</view>
				<view>扫码抢单</view>
			</view>
		</view>

		<!-- <uni-popup ref="popup1" type="center">
			<view class="column-css" style="background: #FFFFFF;width: 560rpx;align-items: center;padding: 15rpx 0;">
				<view style="padding: 10rpx;margin-bottom: 10rpx;">请选择车辆</view>
				<view class="column-css" style="width: 100%;justify-content: center;text-align: center;">
					<block v-for="(item, index) in vehiclelist" :key="index">
						<view style="padding: 15rpx 10rpx;" :style="{ background: index === current ? 'rgba(43,124,255,0.08)' : '#FFFFFF' }" @click="onvehicle(index)">
							{{ item.plateNum }}
						</view>
					</block>
				</view>
				<view class="view-deltail" style="width: 500rpx; margin: 20rpx; background: #FB8536;" @click="scanAdd()">提交</view>
			</view>
		</uni-popup> -->

		<uni-popup ref="popup1" type="center" v-if="ispopup1">
			<view class="column-css" style="background: none;width: 660rpx;margin-top: -300rpx; align-items: center;">
				<view class="column-css"
					style="background: #FFFFFF;width: 660rpx;align-items: center;padding: 15rpx 0;">
					<view style="padding: 10rpx;margin-bottom: 10rpx;">请选择车辆</view>
					<view class="column" style="width: 660rpx;overflow: hidden;">
						<keyboard style="padding-top: 10rpx;" @keyboard="keyboardChange" :textArray="textArray"
							:show.sync="show" :isEnergy="ischeckbox" active-border="#0deafe" base-border="38f8f8f">
						</keyboard>
					</view>
					<view class="row-css"
						style="margin-top: 10rpx;margin-left: -440rpx; line-height: 20rpx; align-items: center;">
						<checkbox :checked="!ischeckbox" style="transform:scale(0.7)" @click="checkbox()"></checkbox>
						<view style="font-size: 24rpx;color: #AAAAAA;"><text>新能源车牌</text></view>
					</view>
					<!-- <view class="column-css" style="width: 100%;justify-content: center;text-align: center;">
						<block v-for="(item, index) in vehiclelist" :key="index">
							<view style="padding: 15rpx 10rpx;" :style="{ background: index === current ? 'rgba(43,124,255,0.08)' : '#FFFFFF' }" @click="onvehicle(index)">
								{{ item.plateNum }}
							</view>
						</block>
					</view> -->
					<view class="row-css car-view">
						<block v-for="(item, index) in vehiclelist" :key="index">
							<view class="car-view-text" @click="oncar(item.plateNum)">{{ item.plateNum }}</view>
						</block>
					</view>
					<view style="height: 1rpx;width: 100%;background: #EEEEEE;"></view>
					<view class="view-deltail" style="width: 500rpx; margin: 20rpx; background: #FB8536;"
						@click="scanAdd()">提交</view>
				</view>
			</view>
		</uni-popup>

		<uni-popup ref="popup2" type="center">
			<view class="column-css" style="background: #FFFFFF;width: 560rpx;padding: 15rpx;">
				<view v-if="nextCheckinWriteShippedNum == 1 || nextCheckinWriteReceiptedNum == 1"
					style="padding: 10rpx;margin-bottom: 10rpx;text-align: center;">
					请输入装/卸货量
				</view>
				<view v-if="nextCheckinWriteShippedNum == 1" class="row-css" style="margin-left: 20rpx;">
					<input v-model="shippedNum" style="border: 1rpx solid #D7D7D7;padding: 10rpx 20rpx;"
						placeholder="请输入装货量" :disabled="unitStr === '车' || unitStr === '箱'" :style="{background: unitStr === '车' || unitStr === '箱' ? '#ddd' : ''}" />
					<view style="margin-left: 20rpx;text-align: center; border: 1rpx solid #D7D7D7;padding: 10rpx 0rpx;">{{unitStr }}
					</view>
				</view>
				<view v-if="nextCheckinWriteReceiptedNum == 1" class="row-css"
					style="margin-left: 20rpx;margin-top: 20rpx;">
					<input v-model="receiptedNum" style="border: 1rpx solid #D7D7D7;padding: 10rpx 20rpx;"
						placeholder="请输入卸货量" :disabled="unitStr === '车' || unitStr === '箱'" :style="{background: unitStr === '车' || unitStr === '箱' ? '#ddd' : ''}"/>
					<view style="margin-left: 20rpx;text-align: center; border: 1rpx solid #D7D7D7;padding: 10rpx 0rpx;">{{unitStr }}
					</view>
				</view>
				<view v-if="nextCheckinUploadPicture == 1" class="column-css"
					style="background: #FFFFFF;margin: 20rpx 0;">
					<scroll-view scroll-y style="max-height: 600rpx;">
						<robby-image-upload :value="imageData" v-model="imageData" :enable-del="true" :enable-add="true"
							:enable-drag="false" :form-data="formData" :header="header" :limit="10"
							:showUploadProgress="false" @delete="deleteImage" @add="addImage"
							:server-url-delete-image="serverUrlDeleteImage" :server-url="serverUrl"></robby-image-upload>
					</scroll-view>
				</view>
				<view class="view-deltail" style="margin: 20rpx; background: #00bfbf;" @click="submit()">提交</view>
			</view>
		</uni-popup>

		<!-- <uni-popup ref="popup3" type="center">
			<view class="column-css" style="background: #FFFFFF;width: 660rpx;align-items: center;padding: 15rpx 0;">
				<view style="padding: 10rpx;margin-bottom: 10rpx;">
					您即将签署
					<text style="color: #2B7CFF;" @click="opensign()">《一单一签运输合同》</text>
				</view>
				<view style="margin:0 30rpx;margin-top: 10rpx;padding: 20rpx;">
					<view style="font-weight: bold;">签约人信息:</view>
					<view class="row-css" style="margin-top: 20rpx;">
						<view class="column-css">
							<view>姓名：</view>
							<view style="padding: 30rpx 0;">身份证号：</view>
							<view style="padding-bottom: 30rpx;">手机号：</view>
							<view style="padding: 12rpx 0;">短信验证码：</view>
						</view>
						<view class="column-css">
							<view>{{ userInfo.driverName }}</view>
							<view style="padding: 30rpx 0;">{{ userInfo.idcard }}</view>
							<view style="padding-bottom: 30rpx;">{{ userInfo.mobile }}</view>
							<view class="row-css" style="text-align: center;">
								<input class="input-code" type="phone" maxlength="6" onkeyup="this.value=this.value.replace(/\D/g,'')" placeholder="验证码" v-model="checkCode" />
								<view class="code-view" @click="sendcode">
									<text style="text-align: center;">{{ codeText }}</text>
								</view>
							</view>
						</view>
					</view>
				</view>

				<view class="row-css" style="margin-left: -130rpx;margin-bottom: 20rpx; align-items: center;">
					<checkbox :checked="ischeckbox" style="transform:scale(0.7)" @click="checkbox()"></checkbox>
					<view style="font-size: 24rpx;color: #AAAAAA;"><text>本人已阅读合同全文并同意所有条款</text></view>
				</view>
				<view class="row-css">
					<view class="view-deltail" style="width: 200rpx; margin: 20rpx; background: #FB8536;" @click="signcanal()">取消</view>
					<view class="view-deltail" style="width: 200rpx; margin: 20rpx;margin-left: 80rpx; background: #FB8536;" @click="signContract()">提交</view>
				</view>
			</view>
		</uni-popup> -->

		<uni-popup ref="popup4" type="center">
			<view class="column-css"
				style="margin: 0 60rpx; align-items: center;background: #FFFFFF;border-radius: 20rpx;">
				<view class="column-css"
					style="width: 100%; background: #007AFF;color: #FFFFFF;padding-bottom: 20rpx; border-top-left-radius: 20rpx;border-top-right-radius: 20rpx;">
					<view style="width: 92%;font-size: 54rpx; text-align: right;padding-top: 10rpx;" @click="clos4()">×
					</view>
					<view style="padding: 10rpx;font-size: 36rpx; margin-bottom: 10rpx;text-align: center;">
						接单提示
					</view>
					<view class="column-css" style="padding: 0 20rpx;padding-bottom: 80rpx;">
						为了保障您在使用运单(接单、运费、结算)相关服务时的合法权益，请您完成相关运输合规资质认证。
					</view>
				</view>

				<view class="row-css view-sold-real" style="margin-top: -50rpx;" @click="onreal(0)">
					<view class="row-css">
						<image style="width: 50rpx;height: 45rpx;margin-right: 10rpx;" src="../../static/icon_real.png">
						</image>
						实名认证
					</view>
					<view v-if='_driverStatus == 3' class="row-css" style="margin-left: 10rpx;"
						:style="{ color: '#F3A73F','font-weight': 'bold' }">
						{{ realNameStext }}
						<image style="width: 40rpx;height: 33rpx;padding: 5rpx 0;" src="../../static/icon_enter.png">
						</image>
					</view>
					<view v-else class="row-css" style="margin-left: 10rpx;"
						:style="{ color: realNameStext == '申诉中' || realNameStext == '已实名' ? '#007AFF' : (realNameStext == '未认证' ? '#707070' : '#F3A73F'),'font-weight': realNameStext == '未认证' ? '100':'bold' }">
						{{ realNameStext }}
						<image style="width: 40rpx;height: 33rpx;padding: 5rpx 0;" src="../../static/icon_enter.png">
						</image>
					</view>
					
				</view>
				<view class="popup4Tips">
					<text v-if="realNametTips">*</text>{{realNametTips}}
				</view>
				<view class="row-css view-sold-real" style="margin: 20rpx 0 12rpx;" @click="onreal(1)">
					<view class="row-css">
						<image style="width: 50rpx;height: 45rpx;margin-right: 10rpx;"
							src="../../static/icon_vehicle.png"></image>
						车辆认证
					</view>
					<view class="row-css" style="margin-left: 10rpx;"
						:style="{ color: vehicleStext == '已认证' || vehicleStext == '申诉中' ? '#007AFF' : (vehicleStext == '未认证' ? '#707070' : '#F3A73F'),'font-weight': vehicleStext == '未认证' ? '100':'bold' }">
						{{ vehicleStext }}
						<image style="width: 40rpx;height: 33rpx;padding: 5rpx 0;" src="../../static/icon_enter.png">
						</image>
					</view>
				</view>
				<view class="popup4Tips">
					<text v-if="vehicletTips">*</text>{{vehicletTips}}
				</view>
				<view class="row-desc" style="margin-bottom: 24rpx;margin-top: 10rpx;" v-if="!realNameFlag || !vehicleFlag">
					<!-- <image v-if="vehicleFlag" src="../../static/icon_home_success.png"></image> -->
					<image src="../../static/icon_home_err.png"></image>
					<view>
						<text v-if="!realNameFlag">{{realNamedesc}}</text>
						<text v-if="!realNameFlag && !vehicleFlag">/</text>
						<text v-if="!vehicleFlag">{{vehicledesc}}</text>
						<text v-if="commonDesc">{{commonDesc}}</text>
					</view>
				</view>
				<!-- <view class="row-css view-sold-real" @click="onreal(2)">
					<view class="row-css">
						<image style="width: 50rpx;height: 45rpx;margin-right: 10rpx;" src="../../static/icon_client.png"></image>
						平台委托签约
					</view>
					<view class="row-css" style="margin-left: 10rpx;" :style="{ color: signStatus == 1 ? '#007AFF' : (signStatus == 2 ? '#F3A73F' : '#707070'),'font-weight': signStatus == 0 ? '100':'bold' }">
						{{ signStext }}
						<image style="width: 40rpx;height: 33rpx;padding: 5rpx 0;" src="../../static/icon_enter.png"></image>
					</view>
				</view> -->
				<!-- <view class="row-css view-sold-real" style="margin-top: 1rpx; margin-bottom: 40rpx;" @click="onreal(3)">
					<view class="row-css">
						<image style="width: 50rpx;height: 45rpx;margin-right: 10rpx;" src="../../static/icon_obile.png"></image>
						手机号实名认证
					</view>
					<view class="row-css" style="margin-left: 10rpx;" :style="{ color: realMobileStatus == 1 ? '#007AFF' : (realMobileStatus == 2 ? '#F3A73F' : '#707070'),'font-weight': realMobileStatus == 0 ? '100':'bold' }">
						{{ realMobileStext }}
						<image style="width: 40rpx;height: 33rpx;padding: 5rpx 0;" src="../../static/icon_enter.png"></image>
					</view>
				</view> -->

			</view>
		</uni-popup>
		<uni-popup ref="popup5" type="center">
			<view class="column-css"
				style="background: #FFFFFF;border-radius: 10rpx; width: 560rpx;align-items: center;padding: 15rpx 0;">
				<view style="padding: 10rpx;margin-bottom: 10rpx;">
					接单提示
				</view>
				<view class="column-css" style="text-align: center;">
					按国家货运合规标准</br>接单后请及时点击起运/到达
				</view>
				<view class="row-css"
					style="margin-left: -130rpx;margin-bottom: 20rpx;margin-top: 20rpx; align-items: center;">
					<checkbox :checked="issigncheckbox" style="transform:scale(0.7)" v-if="isValidCont == 0" @click="signcheckbox()"></checkbox>
					<view style="font-weight: bold;font-size: 26rpx;" v-if="isValidCont == 0" @click="opensign()">我已同意签订该合约</view>
				</view>
				<view style="width: 100%;height: 1rpx;background: #B9B9B9;"></view>
				<view class="row-css" style="width: 100%;">
					<view class="row-css button-view" style="color: #B9B9B9;" @click="signcanal()">关闭</view>
					<view style="height: auto;width: 1rpx;background: #B9B9B9;"></view>
					<view class="row-css button-view" style="color: #007AFF;" @click="signContract()">接单</view>
				</view>
			</view>
		</uni-popup>

		<uni-popup ref="popup6" type="center">
			<view class="column-css" style="background: #FFFFFF;border-radius: 20rpx; width: 620rpx;">
				<view class="column-css"
					style="width: 100%; background: #007AFF;color: #FFFFFF;padding-bottom: 20rpx; border-top-left-radius: 20rpx;border-top-right-radius: 20rpx;">
					<view style="width: 92%;font-size: 48rpx; text-align: right;padding-top: 10rpx;" @click="clos6()">×
					</view>
					<view style="padding: 10rpx;font-size: 36rpx; margin-bottom: 10rpx;text-align: center;">
						手机号实名认证
					</view>
					<view class="column-css" style="text-align: center;">
						为了您的收款资金安全，银行转账时会</br>验证您的手机号是否在手机运营商实名开户，</br>请先完成实名手机号验证
					</view>
				</view>
				<view class="column-css" style="margin: 20rpx;">
					<view style="padding: 10rpx;">收款姓名：{{userInfo.driverName }}</view>
					<view class="row-css" style="padding: 10rpx;align-items: center;">手机号：
						<input class="input-code" style="width: 70%;text-align: left;padding-left: 10rpx;"
							v-model="mobile" type="phone" maxlength="11"
							onkeyup="this.value=this.value.replace(/\D/g,'')" placeholder="请输入在手机运营商已实名手机号" />
					</view>
					<view class="row-css" style="padding: 10rpx;">
						<view class="row-css" style="align-items: center;">验证码：</view>
						<view class="row-css" style="justify-content: center;">
							<input class="input-code" type="phone" maxlength="6"
								onkeyup="this.value=this.value.replace(/\D/g,'')" placeholder="验证码"
								v-model="checkCode" />
							<view class="code-view" @click="sendcode">
								<text style="text-align: center;">{{ codeText }}</text>
							</view>
						</view>
					</view>
				</view>
				<view v-if="errtext != ''" class="row-css"
					style="padding: 20rpx;margin-bottom: 40rpx;font-size: 28rpx;color: #F0AD4E;">
					<image style="width: 30rpx; height: 30rpx;padding-top: 6rpx;margin-right: 10rpx;" mode="aspectFill"
						src="../../static/icon_caveat.png"></image>{{errtext }}
				</view>

				<view style="width: 100%;height: 1rpx;background: #B9B9B9;"></view>
				<view class="row-css" style="width: 100%;">
					<view class="row-css button-view" style="color: #B9B9B9;" @click="clos6()">取消</view>
					<view style="height: auto;width: 1rpx;background: #B9B9B9;"></view>
					<view class="row-css button-view" style="color: #007AFF;" @click="onVerifyMobile()">确认</view>
				</view>
			</view>
		</uni-popup>
		<sign-modal :show="signPopShow" ref="signPop" @close="signPopShow = false"></sign-modal>
		<sign-modal :show="batchSignPopShow" ref="batchSignPop" :is-batch="true" @close="batchSignPopShow = false"></sign-modal>
		<!-- #ifdef MP-WEIXIN -->
		<privacy-pop></privacy-pop>
		<!-- #endif -->
	</view>
</template>

<script>
	import Gps from './gps/index.js'
	import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js';
	import MescrollBody from '@/uni_modules/mescroll-uni/components/mescroll-body/mescroll-body.vue';
	import robbyImageUpload from '@/components/robby-image-upload/robby-image-upload.vue';
	import keyboard from '../../components/mpvue-keyboard.vue';
	// #ifdef APP-PLUS
	import permision from '@/components/permission.js';
	// 获取 module  引入App原生插件
	var locationModule = uni.requireNativePlugin('LocationModule');
	// #endif
	import privacyPop from '@/components/privacyPopup/privacyPopup.vue'
	import helper from '@/common/helper'
	import signModal from './taskhomeModal/signModal.vue'
	const gps = new Gps()
	export default {
		mixins: [MescrollMixin], // 使用mixin
		components: {
			MescrollBody,
			robbyImageUpload,
			keyboard,
			privacyPop,
			signModal
		},
		data() {
			return {
				userInfo: {}, //
				mobile: uni.getStorageSync(this.DATA_KEY.userInfo).mobile,
				islivingcertifi: '未认证',
				platformCoName: '',
				platformCoNo: '',
				checkCode: '',
				time: 120,
				codeText: '获取验证码',
				errtext: '',
				imageData: [],
				imageurl: [],
				unitStr: '',
				scanloadingOrderId: '',
				projectCode: '',
				orderloadingOrderId: '',
				ordercheckinSeq: '',
				CheckinNodeName: '',
				nextCheckinWriteShippedNum: '',
				nextCheckinWriteReceiptedNum: '',
				nextCheckinUploadPicture: '',
				tasklist: [],
				vehiclelist: [],
				platenNum: '',
				current: 0,
				signChannel: 0,
				scanwaybillId: '',
				shippedNum: '',
				receiptedNum: '',
				etpId: '',
				etpName: '',
				options: [],
				count: 0,
				page: 1,
				pageSize: 10,
				serverUrl: this.API + '/driverService/upload',
				serverUrlDeleteImage: '',
				formData: {
					fileType: '8',
					phoneNumber: uni.getStorageSync(this.DATA_KEY.userInfo).phoneNumber,
					fileId: Math.floor(Math.random() * 1259),
					ocrOrNot: '0',
					orderId: this.billNo
				},
				header: {
					'Content-Type': 'multipart/form-data;boundary=ebf9f03029db4c2799ae16b5428b06bds',
					token: uni.getStorageSync(this.DATA_KEY.token)
				},
				mescroll: null, // mescroll实例对象 (此行可删,mixins已默认)
				// 下拉刷新的配置(可选, 绝大部分情况无需配置)
				downOption: {},
				// 上拉加载的配置(可选, 绝大部分情况无需配置)
				upOption: {
					page: {
						num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
						size: 10 // 每页数据的数量,默认10
					},
					noMoreSize: 5, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
					empty: {
						tip: '暂无相关数据'
					}
				},
				show: true,
				ischeckbox: true,
				issigncheckbox: true,
				textArray: '',
				ishine: false,
				ispopup1: true,
				flagindex: -1,
				realNameStatus: 0,
				realNameStext: '未认证',
				realNametTips:'请按提示完成个人信息认证',//弹框司机未认证的提示信息
				realNamedesc: '',
				realNameFlag: true,
				vehicledesc: '',
				commonDesc: '',
				vehicleFlag: true,
				vehicleStatus: 0,
				vehicleStext: '未认证',
				vehicletTips:'请按提示完成车辆认证',//弹框未认证的提示信息车辆
				signStatus: 0,
				signStext: '未签约',
				realMobileStatus: 0,
				realMobileStext: '未认证',
				isscan: false,
				_driverStatus: 0,
				billNo: '',
				messagetips: '',//消息中心
				daibanNum:'', //待办悬浮的数量
				buesinessNum: '',
				driverStatustip: '',//司机企业关联关系
				
				signPopShow: false, // 是否显示签约弹窗
				batchSignPopShow: false, // 是否显示代办批量签约弹窗
				// setText: '位置获取失败'
				// test: false
				
				isValidCont: null, // 企业是否配置强制校验电子签
			};
		},
		watch:{
			shippedNum(newval,old){
				this.$nextTick(() => {
					this.shippedNum = newval ? String(newval).replace(/\s*/g,"") : ''
				})
			},
			receiptedNum(newval,old){
				this.$nextTick(() => {
					this.receiptedNum = newval ? String(newval).replace(/\s*/g,"") : ''
				})
			},
		},
		methods: {
			// changeSetText() {
			// 	// this.setText = this.setText == '位置开启失败' ? '位置获取失败' : '位置开启失败'
			// 	this.setText = this.setText == '位置获取失败' ? '' : '位置获取失败'
			// },
			goBackAccount() {
				// uni.navigateTo({
				// 	url: '/pages/account/backAccount'
				// })
				this.wxRequest({
					url: `${this.API}/driverService/getSysOption`,
					method: 'GET',
					data: {},
					success: res => {
						console.log(res)
						if(res.data.msg == 1){
							uni.navigateTo({
								url: '/pages/account/backAccount'
							})
						} else {
							uni.showModal({
								content: '如您的原手机号无法接收登陆短信，请联系平台管理员找回账号并修改手机号',
								showCancel: false,
								success(modalRes) {
									if (modalRes.confirm) {
										
									}
								}
							})
						}
					}
				})
			},
			//获取消息中心按钮展示什么数据
			getMessage(){
				this.wxRequest({
					url: `${this.API}/driverMessageCommon/queryBellNum`,
					method: 'POST',
					data: {  "driverId": this.userInfo.driverId, "etpId": uni.getStorageSync(this.DATA_KEY.etpId) },
					success: res => {
						console.log(res)
						if(res.data.code == 0){
							let info =  res.data.data
							// businessdriver 业务进度capitaldriver 资金变动  certification账号资质
							if(!info.certificationNum && info.buesinessNum && !info.daibanNum && !info.capiatlNum){
								this.messagetips = ''
								this.buesinessNum  =  info.buesinessNum 
							}else{
								this.messagetips = info.certificationNum + info.capiatlNum + info.daibanNum
								this.daibanNum = info.daibanNum
								this.buesinessNum =  info.buesinessNum
							}
						}
					}
				})
			},
			//跳转到消息中心页面
			jumpMessage(){
				uni.navigateTo({
					url: '/pages/message/index'
				});
			},
			onLogin() {
				if (this.userInfo.mobilePhone != '') {
					// #ifdef MP-WEIXIN
					uni.navigateTo({
						// url: '/pages/personal/quicklogin'
						url: '/pages/personal/login'
					});
					// #endif
					// #ifdef APP-PLUS
					uni.navigateTo({
						url: '../personal/login'
					});
					// #endif
				}
			},
			oncar(car) {
				this.textArray = car.replace(/\s*/g, '');
			},
			checkbox: function() {
				this.ischeckbox = !this.ischeckbox;
			},
			signcheckbox: function() {
				this.issigncheckbox = !this.issigncheckbox;
			},
			keyboardChange(e) {
				this.platenNum = e;
				console.log(e)
				console.log(this.platenNum.length)
				console.log(this.ischeckbox)
				if (this.ischeckbox) {
					if (this.platenNum.length == 7) {
						this.wxRequest({
							url: `${this.API}/miniApp/vehicle/queryVehicle?plateNum=${this.platenNum}`,
							method: 'GET',
							success: res => {
								console.log(res)
								if (res.data.data) {
									let vehicleInfoId = res.data.data.vehicleInfoId
									this.wxRequest({
										url: `${this.API}/blacklist/queryBlacklist`,
										method: 'POST',
										data: {
											etpId: uni.getStorageSync(this.DATA_KEY.etpId),
											typeId: "2", //id类型 1司机 2车辆
											driverVehicleId: vehicleInfoId
										},
										success: res1 => {
											if (res1.data.data) {
												this.$refs.popup1.close();
												uni.showModal({
													title: '禁止接单',
													content: `车辆：${this.platenNum}已被${uni.getStorageSync(this.DATA_KEY.etpName)}列为黑名单，请更换其他车辆`,
													showCancel: false,
													confirmText: '确定',
													confirmColor: '#49A9F0',
													success: function(res) {

													}
												});
											}
										}
									});
								} else {
									uni.showToast({
										icon: 'none',
										title: '为查询该车辆',
										mask: true,
										duration: 2000
									});
								}
							}
						});
					}
				} else {
					if (this.platenNum.length == 8) {
						this.wxRequest({
							url: `${this.API}/miniApp/vehicle/queryVehicle?plateNum=${this.platenNum}`,
							method: 'GET',
							success: res => {
								console.log(res)
								if (res.data.data) {
									let vehicleInfoId = res.data.data.vehicleInfoId
									this.wxRequest({
										url: `${this.API}/blacklist/queryBlacklist`,
										method: 'POST',
										data: {
											etpId: uni.getStorageSync(this.DATA_KEY.etpId),
											typeId: "2", //id类型 1司机 2车辆
											driverVehicleId: vehicleInfoId
										},
										success: res1 => {
											if (res1.data.data) {
												this.$refs.popup1.close();
												uni.showModal({
													title: '禁止接单',
													content: `车辆：${this.platenNum}已被${uni.getStorageSync(this.DATA_KEY.etpName)}列为黑名单，请更换其他车辆`,
													showCancel: false,
													confirmText: '确定',
													confirmColor: '#49A9F0',
													success: function(res) {

													}
												});
											}
										}
									});
								} else {
									uni.showToast({
										icon: 'none',
										title: '为查询到该车辆',
										mask: true,
										duration: 2000
									});
								}
							}
						});
					}
				}
				// uni.showToast({
				// 	icon: 'none',
				// 	title: e,
				// 	mask: true,
				// 	duration: 2000
				// });
			},
			opensign() {
				// uni.navigateTo({
				// 	url: '../task/singlesign'
				// });
				uni.navigateTo({
					url: `../task/singlesign?loadingOrderId=` + this.scanloadingOrderId
				});
				// this.ishine = true;
				// uni.showLoading({
				// 	title: '合同模板加载中。。。',
				// 	mask: true
				// });
				// uni.downloadFile({
				// 	url: 'https://y2t-nfp-prd-1258746579.cos.ap-guangzhou.myqcloud.com/ydyq/ydyq-contract-tmplate-YS_3086.pdf',
				// 	// #ifdef MP-WEIXIN
				// 	filePath: wx.env.USER_DATA_PATH + '/一单一签运输合同.pdf', //指定的本地文件路径   一定要带文件后缀名  不然无法打开   wx.env.USER_DATA_PATH类似本地文件根目录
				// 	// #endif
				// 	success(res) {
				// 		console.log(res);
				// 		let data = '';
				// 		// #ifdef MP-WEIXIN
				// 		data = res.filePath;
				// 		// #endif
				// 		// #ifdef APP-PLUS
				// 		data = res.tempFilePath;
				// 		// #endif
				// 		uni.openDocument({
				// 			filePath: data,
				// 			showMenu: true, //表示右上角是否有转发按钮
				// 			fileType: 'pdf',
				// 			success: function(res) {
				// 				uni.hideLoading();
				// 				console.log('打开文档成功');
				// 			}
				// 		});
				// 	}
				// });
			},
			sendcode() {
				if (this.time == 120) {
					// this.projectCode = Math.floor(Math.random() * 1259);
					this.wxRequest({
						url: `${this.API}/driverService/getVerifyMobileCode`,
						method: 'POST',
						data: {
							driverId: this.userInfo.driverId,
							realMobile: this.mobile
						},
						title: '验证码发送中...',
						success: res => {
							if (res.data.data.status == 1) {
								this.errtext = res.data.data.message;
							} else {
								this.errtext = '';
								uni.showToast({
									title: '验证码已发送',
									icon: 'none'
								});
								this.timer = setInterval(() => {
									this.codeText = `${this.time}s后获取验证码`;
									this.time--;
									if (this.time < 0) {
										this.time = 120;
										this.codeText = '获取验证码';
										clearInterval(this.timer);
									}
								}, 1000);
							}
						}
					});
				}
			},
			signcanal() {
				this.page = 1;
				this.onwaybill(this.mescroll);
				this.$refs.popup5.close();
			},
			signContract: async function() {
				let taskvalue = uni.getStorageSync(this.DATA_KEY.taskvalue)
				this.ishine = false;
				let that = this;
				if (!that.issigncheckbox && that.isValidCont == 0) {
					uni.showToast({
						title: '请勾选同意相关条款',
						icon: 'none'
					});
					return;
				}
				that.$refs.popup5.close();
				
				await that.receive(taskvalue)
				let fenceData = await this.createCircleFenceIsSuccess(taskvalue)
				if (fenceData && fenceData.data.fenceStatus == 1) {
					that.logFn(`fenceStatus=1,接单`)
					gps.init()
					let result = await gps.startLoctionBackgroundUpdate(taskvalue, that.cronJsFance)
					// that.page = 1
					// that.onwaybill(that.mescroll)
				}
				return false
				// #ifdef APP-PLUS
				var result;
				if (uni.getSystemInfoSync().platform == 'android') {
					//await Number permission.requestAndroidPermission(String permissionID)   
					//Android设备上当前App是否有某个权限
					//android.permission.ACCESS_FINE_LOCATION  位置权限
					result = await permision.requestAndroidPermission('android.permission.ACCESS_FINE_LOCATION');
					uni.showToast({
						title: result,
						icon: 'none'
					});
					//permision.checkSystemEnableLocation()  获取当前手机是否开启或关闭了定位服务   返回false或 true;
					if (permision.checkSystemEnableLocation() == false) {
						uni.showModal({
							title: '提示',
							content: '请开启手机gps定位,设置-隐私-位置',
							showCancel: false,
							success: function(res) {}
						});
						return;
					} else {
						that.wxRequest({
							url: `${that.API}/miniApp/loadingOrder/receive`,
							method: 'POST',
							data: {
								// #ifdef MP-WEIXIN
								clickLocation: 3,
								// #endif
								// #ifdef APP-PLUS
								clickLocation: 1,
								// #endif
								loadingOrderId: that.scanloadingOrderId,
							},
							title: '接单中...',
							success: res => {
								uni.showToast({
									title: '抢单成功！',
									icon: 'none'
								});
								that.$refs.popup5.close();
								that.page = 1;
								that.onwaybill(that.mescroll);


								that.wxRequest({
									url: `${that.API}/fance/waybillFence/createCircleFenceIsSuccess?waybillId=${uni.getStorageSync(this.DATA_KEY.waybillId)}`,
									method: 'get',
									title: '加载中...',
									success: res => {
										console.log(res.data)
										console.log(!res.data.data)
										if (res.data.data.fenceStatus == 1) {
											let islocation = false;
											// #ifdef MP-WEIXIN
											uni.getSystemInfo({
												success(res) {
													var isopendingwei = res
														.locationEnabled;
													if (isopendingwei == false) {
														uni.showModal({
															title: '提示',
															content: '请开启手机gps定位,设置-隐私-位置',
															showCancel: false,
															success: function(
																res) {}
														});
													} else {
														//获取位置后台定位授权
														uni.authorize({
															scope: 'scope.userLocationBackground',
															success(infoRes) {
																uni.getSetting({
																	success(
																		res
																		) {
																		that
																	.$forceUpdate();
																		if (!
																			res
																			.authSetting[
																				'scope.userLocationBackground'
																				]
																			) {
																			uni.showModal({
																				title: '"司机小程序"需要获取您的当前位置',
																				content: '请点击设置->打开位置信息->使用小程序期间和离开小程序后',
																				confirmText: '设置',
																				showCancel: false,
																				success(
																					res
																					) {
																					if (res
																						.confirm
																						) {
																						uni.openSetting({
																							success(
																								res
																								) {}
																						});
																					}
																				}
																			});
																		} else {
																			islocation
																				=
																				true;
																			uni.setStorageSync(
																				that
																				.DATA_KEY
																				.loadingOrderId,
																				that
																				.scanloadingOrderId
																				);
																			wx.startLocationUpdateBackground({
																				success: res => {
																					console
																						.log(
																							res
																							)
																					wx.onLocationChange(
																						data => {
																							var currentTime =
																								new Date()
																								.getTime();
																							var oldTime =
																								uni
																								.getStorageSync(
																									that
																									.DATA_KEY
																									.timeOld
																									);
																							console
																								.log(
																									currentTime,
																									oldTime,
																									currentTime -
																									oldTime >
																									180000
																									);
																							if (currentTime -
																								oldTime >
																								180000
																								) {
																								uni.setStorageSync(
																									that
																									.DATA_KEY
																									.timeOld,
																									currentTime
																									);
																								that.wxRequest({
																									url: `${that.API}/fance/waybillFence/cronJsFance`,
																									method: 'POST',
																									data: {
																										vehicleNo: taskvalue
																											.vehicleNo,
																										driverTel: uni
																											.getStorageSync(
																												that
																												.DATA_KEY
																												.userInfo
																												)
																											.mobile,
																										trackType: 2,
																										driverId: uni
																											.getStorageSync(
																												that
																												.DATA_KEY
																												.userInfo
																												)
																											.driverId,
																										loadingOrderId: uni
																											.getStorageSync(
																												that
																												.DATA_KEY
																												.loadingOrderId
																												),
																										lat: data
																											.latitude,
																										lng: data
																											.longitude
																									},
																									success: res => {
																										console
																											.log(
																												res
																												)
																									}
																								});
																							}
																						}
																						);
																				},
																				fail: res => {
																					console
																						.log(
																							'获取位置失败',
																							res
																							);
																				}
																			});
																		}
																	}
																});
															},
															fail(res) {
																uni.showModal({
																	title: '"司机小程序"需要获取您的当前位置',
																	content: '请点击设置->打开位置信息->使用小程序期间和离开小程序后',
																	confirmText: '设置',
																	showCancel: false,
																	success(
																		res
																		) {
																		if (res
																			.confirm
																			) {
																			uni.openSetting({
																				success(
																					res
																					) {}
																			});
																		}
																	}
																});
															}
														});
													}
												}
											});
											// #endif
											// #ifdef APP-PLUS
											if (uni.getSystemInfoSync().platform ==
												'android') {
												if (permision.checkSystemEnableLocation() ==
													false) {
													uni.showModal({
														title: '提示',
														content: '请开启手机gps定位,设置-隐私-位置',
														showCancel: false,
														success: function(res) {}
													});
													return;
												} else {
													if (result == 1) {
														that.$forceUpdate();
														islocation = true;
														locationModule.start({
																appSecurity: taskvalue
																	.appSecurity,
																enterpriseSenderCode: taskvalue
																	.enterpriseSenderCode,
																ShippingNoteNumber: taskvalue
																	.loadingOrderId,
																StartCountrySubdivisionCode: taskvalue
																	.shippingRegionCode,
																EndCountrySubdivisionCode: taskvalue
																	.receiptRegionCode,
																StartLongitude: taskvalue
																	.StartLongitude,
																StartLatitude: taskvalue
																	.StartLatitude,
																EndLongitude: taskvalue
																	.EndLongitude,
																EndLatitude: taskvalue
																	.EndLatitude,
																StartLocationText: taskvalue
																	.shippingCity,
																EndLocationText: taskvalue
																	.receiptCity,
																VehicleNumber: taskvalue
																	.vehicleNo,
																DriverName: taskvalue
																	.driverName
															},
															ret => {
																let rets = ret.code;
																uni.getLocation({
																	type: 'wgs84',
																	success: function(
																		res) {
																		let longitude =
																			res
																			.longitude;
																		let latitude =
																			res
																			.latitude;
																		if (rets ==
																			'发送定位send成功'
																			) {
																			uni.setStorageSync(
																				'loadingOrderId',
																				taskvalue
																				.loadingOrderId
																				);
																			//发送定位回调
																			uni.request({
																				url: `https://sign.y2t.com/tax/taxInfoUpload`,
																				method: 'POST',
																				data: {
																					vehicleNumber: taskvalue
																						.vehicleNo,
																					driverName: taskvalue
																						.driverName,
																					shippingNoteNumber: taskvalue
																						.loadingOrderId,
																					longitude: longitude,
																					latitude: latitude,
																					status: 1
																				},
																				success: res => {
																					uni
																				.hideLoading();
																					console
																						.log(
																							'发送定位回调结果',
																							res
																							);
																				},
																				fail: error => {
																					uni
																				.hideLoading();
																					uni.showToast({
																						title: '网络异常！',
																						icon: 'none'
																					});
																				},
																				complete: res => {
																					if (obj
																						.complete
																						)
																						obj
																						.complete(
																							res
																							);
																				}
																			});
																			console
																				.log(
																					'====================================',
																					taskvalue
																					.loadingOrderId
																					);
																		}
																		//上传坐标点

																		that.wxRequest({
																			url: `${that.API}/fance/waybillFence/cronJsFance`,
																			method: 'POST',
																			data: {
																				vehicleNo: taskvalue
																					.vehicleNo,
																				driverTel: uni
																					.getStorageSync(
																						that
																						.DATA_KEY
																						.userInfo
																						)
																					.mobile,
																				trackType: 3,
																				driverId: uni
																					.getStorageSync(
																						that
																						.DATA_KEY
																						.userInfo
																						)
																					.driverId,
																				loadingOrderId: taskvalue
																					.loadingOrderId,
																				lat: latitude,
																				lng: longitude
																			},
																			success: res => {
																				console
																					.log(
																						res
																						)
																			}
																		});
																	},
																	fail: (
																	err) => {
																		uni.showToast({
																			title: "位置定位失败，请查看定位权限是否开启",
																			icon: "none"
																		})
																	}
																});
																console.log('发送定位结果', ret
																	.code);
															}
														);
														//App定时器3分钟调一次
														that.Interval01 = setInterval(() => {

															// 调用异步方法启动定位
															console.log(
																'd======================调用异步方法启动定位 '
																);
															locationModule.start({
																	appSecurity: taskvalue
																		.appSecurity,
																	enterpriseSenderCode: taskvalue
																		.enterpriseSenderCode,
																	ShippingNoteNumber: taskvalue
																		.loadingOrderId,
																	StartCountrySubdivisionCode: taskvalue
																		.shippingRegionCode,
																	EndCountrySubdivisionCode: taskvalue
																		.receiptRegionCode,
																	StartLongitude: taskvalue
																		.StartLongitude,
																	StartLatitude: taskvalue
																		.StartLatitude,
																	EndLongitude: taskvalue
																		.EndLongitude,
																	EndLatitude: taskvalue
																		.EndLatitude,
																	StartLocationText: taskvalue
																		.shippingCity,
																	EndLocationText: taskvalue
																		.receiptCity,
																	VehicleNumber: taskvalue
																		.vehicleNo,
																	DriverName: taskvalue
																		.driverName
																},
																ret => {
																	let rets = ret
																		.code;
																	uni.getLocation({
																		type: 'wgs84',
																		success: function(
																			res
																			) {
																			uni.showModal({
																				title: res,
																			})
																			let longitude =
																				res
																				.longitude;
																			let latitude =
																				res
																				.latitude;
																			uni.setStorageSync(
																				'loadingOrderId',
																				taskvalue
																				.loadingOrderId
																				);
																			if (rets ==
																				'发送定位send成功'
																				) {
																				// uni.setStorageSync('loadingOrderId', taskvalue.loadingOrderId);
																				//发送定位回调
																				uni.request({
																					url: `https://sign.y2t.com/tax/taxInfoUpload`,
																					method: 'POST',
																					data: {
																						vehicleNumber: taskvalue
																							.vehicleNo,
																						driverName: taskvalue
																							.driverName,
																						shippingNoteNumber: taskvalue
																							.loadingOrderId,
																						longitude: longitude,
																						latitude: latitude,
																						status: 1
																					},
																					success: res => {
																						uni
																					.hideLoading();
																						console
																							.log(
																								'发送定位回调结果',
																								res
																								);
																					},
																					fail: error => {
																						uni
																					.hideLoading();
																						uni.showToast({
																							title: '网络异常！',
																							icon: 'none'
																						});
																					},
																					complete: res => {
																						if (obj
																							.complete
																							)
																							obj
																							.complete(
																								res
																								);
																					}
																				});
																				console
																					.log(
																						'====================================',
																						taskvalue
																						.loadingOrderId
																						);
																			}

																			//上传坐标点
																			that.wxRequest({
																				url: `${that.API}/fance/waybillFence/cronJsFance`,
																				method: 'POST',
																				data: {
																					vehicleNo: taskvalue
																						.vehicleNo,
																					driverTel: uni
																						.getStorageSync(
																							that
																							.DATA_KEY
																							.userInfo
																							)
																						.mobile,
																					trackType: 3,
																					driverId: uni
																						.getStorageSync(
																							that
																							.DATA_KEY
																							.userInfo
																							)
																						.driverId,
																					loadingOrderId: uni
																						.getStorageSync(
																							that
																							.DATA_KEY
																							.loadingOrderId
																							),
																					lat: latitude,
																					lng: longitude
																				},
																				success: res => {
																					console
																						.log(
																							res
																							)
																				}
																			});
																		},
																		fail: err => {
																			uni.showToast({
																				title: "位置定位失败，请查看定位权限是否开启",
																				icon: "none"
																			})
																		}
																	});
																	console.log(
																		'发送定位结果',
																		ret
																		.code);
																	// uni.showModal({
																	// 	title: '提示',
																	// 	content: ret.code,
																	// 	showCancel: false,
																	// 	success: function(res) {
																	// 		if (res.confirm) {
																	// 			console.log('用户点击确定');
																	// 		}
																	// 	}
																	// });
																}
															);
														}, 180000);
													} else {
														uni.showModal({
															title: '该程序需要获取您的当前位置',
															confirmText: '去授权',
															showCancel: false,
															success(res) {
																if (res.confirm) {
																	permision
																		.gotoAppPermissionSetting();
																}
															}
														});
													}
												}
											} else if (uni.getSystemInfoSync().platform ==
												'ios') {
												islocation = true;
												locationModule.start({
														appSecurity: taskvalue.appSecurity,
														enterpriseSenderCode: taskvalue
															.enterpriseSenderCode,
														ShippingNoteNumber: taskvalue
															.loadingOrderId,
														StartCountrySubdivisionCode: taskvalue
															.shippingRegionCode,
														EndCountrySubdivisionCode: taskvalue
															.receiptRegionCode,
														StartLongitude: taskvalue
															.StartLongitude,
														StartLatitude: taskvalue
															.StartLatitude,
														EndLongitude: taskvalue
															.EndLongitude,
														EndLatitude: taskvalue.EndLatitude,
														StartLocationText: taskvalue
															.shippingCity,
														EndLocationText: taskvalue
															.receiptCity,
														VehicleNumber: taskvalue.vehicleNo,
														DriverName: taskvalue.driverName
													},
													ret => {
														let rets = ret.code;
														uni.getLocation({
															type: 'wgs84',
															success: function(
															res) {
																let longitude =
																	res
																	.longitude;
																let latitude =
																	res
																	.latitude;
																if (rets ==
																	'发送定位send成功'
																	) {
																	uni.setStorageSync(
																		'loadingOrderId',
																		taskvalue
																		.loadingOrderId
																		);
																	//发送定位回调
																	uni.request({
																		url: `https://sign.y2t.com/tax/taxInfoUpload`,
																		method: 'POST',
																		data: {
																			vehicleNumber: taskvalue
																				.vehicleNo,
																			driverName: taskvalue
																				.driverName,
																			shippingNoteNumber: taskvalue
																				.loadingOrderId,
																			longitude: longitude,
																			latitude: latitude,
																			status: 1
																		},
																		success: res => {
																			uni
																		.hideLoading();
																			console
																				.log(
																					'发送定位回调结果',
																					res
																					);
																		},
																		fail: error => {
																			uni
																		.hideLoading();
																			uni.showToast({
																				title: '网络异常！',
																				icon: 'none'
																			});
																		},
																		complete: res => {
																			if (obj
																				.complete
																				)
																				obj
																				.complete(
																					res
																					);
																		}
																	});
																	console
																		.log(
																			'====================================',
																			taskvalue
																			.loadingOrderId
																			);
																}
																//上传坐标点

																that.wxRequest({
																	url: `${that.API}/fance/waybillFence/cronJsFance`,
																	method: 'POST',
																	data: {
																		vehicleNo: taskvalue
																			.vehicleNo,
																		driverTel: uni
																			.getStorageSync(
																				that
																				.DATA_KEY
																				.userInfo
																				)
																			.mobile,
																		trackType: 3,
																		driverId: uni
																			.getStorageSync(
																				that
																				.DATA_KEY
																				.userInfo
																				)
																			.driverId,
																		loadingOrderId: taskvalue
																			.loadingOrderId,
																		lat: latitude,
																		lng: longitude
																	},
																	success: res => {
																		console
																			.log(
																				res
																				)
																	}
																});
															},
															fail: (err) => {
																uni.showToast({
																	title: "位置定位失败，请查看定位权限是否开启",
																	icon: "none"
																})
															}
														});
														console.log('发送定位结果', ret.code);
													}
												);
												that.Interval01 = setInterval(() => {

													// 调用异步方法启动定位
													console.log(
														'd======================调用异步方法启动定位 '
														);
													locationModule.start({
															appSecurity: taskvalue
																.appSecurity,
															enterpriseSenderCode: taskvalue
																.enterpriseSenderCode,
															ShippingNoteNumber: taskvalue
																.loadingOrderId,
															StartCountrySubdivisionCode: taskvalue
																.shippingRegionCode,
															EndCountrySubdivisionCode: taskvalue
																.receiptRegionCode,
															StartLongitude: taskvalue
																.StartLongitude,
															StartLatitude: taskvalue
																.StartLatitude,
															EndLongitude: taskvalue
																.EndLongitude,
															EndLatitude: taskvalue
																.EndLatitude,
															StartLocationText: taskvalue
																.shippingCity,
															EndLocationText: taskvalue
																.receiptCity,
															VehicleNumber: taskvalue
																.vehicleNo,
															DriverName: taskvalue
																.driverName
														},
														ret => {
															let rets = ret.code;
															uni.getLocation({
																type: 'wgs84',
																success: function(
																	res
																	) {
																	let longitude =
																		res
																		.longitude;
																	let latitude =
																		res
																		.latitude;
																	uni.setStorageSync(
																		'loadingOrderId',
																		taskvalue
																		.loadingOrderId
																		);
																	if (rets ==
																		'发送定位send成功'
																		) {
																		// uni.setStorageSync('loadingOrderId', taskvalue.loadingOrderId);
																		//发送定位回调
																		uni.request({
																			url: `https://sign.y2t.com/tax/taxInfoUpload`,
																			method: 'POST',
																			data: {
																				vehicleNumber: taskvalue
																					.vehicleNo,
																				driverName: taskvalue
																					.driverName,
																				shippingNoteNumber: taskvalue
																					.loadingOrderId,
																				longitude: longitude,
																				latitude: latitude,
																				status: 1
																			},
																			success: res => {
																				uni
																			.hideLoading();
																				console
																					.log(
																						'发送定位回调结果',
																						res
																						);
																			},
																			fail: error => {
																				uni
																			.hideLoading();
																				uni.showToast({
																					title: '网络异常！',
																					icon: 'none'
																				});
																			},
																			complete: res => {
																				if (obj
																					.complete
																					)
																					obj
																					.complete(
																						res
																						);
																			}
																		});
																		console
																			.log(
																				'====================================',
																				taskvalue
																				.loadingOrderId
																				);
																	}

																	//上传坐标点
																	that.wxRequest({
																		url: `${that.API}/fance/waybillFence/cronJsFance`,
																		method: 'POST',
																		data: {
																			vehicleNo: taskvalue
																				.vehicleNo,
																			driverTel: uni
																				.getStorageSync(
																					that
																					.DATA_KEY
																					.userInfo
																					)
																				.mobile,
																			trackType: 3,
																			driverId: uni
																				.getStorageSync(
																					that
																					.DATA_KEY
																					.userInfo
																					)
																				.driverId,
																			loadingOrderId: taskvalue
																				.loadingOrderId,
																			lat: latitude,
																			lng: longitude
																		},
																		success: res => {
																			console
																				.log(
																					res
																					)
																		}
																	});
																},
																fail: err => {
																	uni.showToast({
																		title: "位置定位失败，请查看定位权限是否开启",
																		icon: "none"
																	})
																}
															});
															console.log('发送定位结果',
																ret.code);
														}
													);
												}, 180000);

											}
											// #endif
										}
									}
								});
							}
						});
					}
				} else {
					that.wxRequest({
						url: `${that.API}/miniApp/loadingOrder/receive`,
						method: 'POST',
						data: {
							// #ifdef MP-WEIXIN
							clickLocation: 3,
							// #endif
							// #ifdef APP-PLUS
							clickLocation: 1,
							// #endif
							loadingOrderId: that.scanloadingOrderId,
						},
						title: '接单中...',
						success: res => {
							uni.showToast({
								title: '抢单成功！',
								icon: 'none'
							});
							that.$refs.popup5.close();
							that.page = 1;
							that.onwaybill(that.mescroll);


							that.wxRequest({
								url: `${that.API}/fance/waybillFence/createCircleFenceIsSuccess?waybillId=${uni.getStorageSync(this.DATA_KEY.waybillId)}`,
								method: 'get',
								title: '加载中...',
								success: res => {
									console.log(res.data)
									console.log(!res.data.data)
									if (res.data.data.fenceStatus == 1) {
										let islocation = false;
										// #ifdef MP-WEIXIN
										uni.getSystemInfo({
											success(res) {
												var isopendingwei = res
												.locationEnabled;
												if (isopendingwei == false) {
													uni.showModal({
														title: '提示',
														content: '请开启手机gps定位,设置-隐私-位置',
														showCancel: false,
														success: function(
														res) {}
													});
												} else {
													//获取位置后台定位授权
													uni.authorize({
														scope: 'scope.userLocationBackground',
														success(infoRes) {
															uni.getSetting({
																success(
																	res
																	) {
																	that
																.$forceUpdate();
																	if (!
																		res
																		.authSetting[
																			'scope.userLocationBackground'
																			]
																		) {
																		uni.showModal({
																			title: '"司机小程序"需要获取您的当前位置',
																			content: '请点击设置->打开位置信息->使用小程序期间和离开小程序后',
																			confirmText: '设置',
																			showCancel: false,
																			success(
																				res
																				) {
																				if (res
																					.confirm
																					) {
																					uni.openSetting({
																						success(
																							res
																							) {}
																					});
																				}
																			}
																		});
																	} else {
																		islocation
																			=
																			true;
																		uni.setStorageSync(
																			that
																			.DATA_KEY
																			.loadingOrderId,
																			that
																			.scanloadingOrderId
																			);
																		wx.startLocationUpdateBackground({
																			success: res => {
																				console
																					.log(
																						res
																						)
																				wx.onLocationChange(
																					data => {
																						var currentTime =
																							new Date()
																							.getTime();
																						var oldTime =
																							uni
																							.getStorageSync(
																								that
																								.DATA_KEY
																								.timeOld
																								);
																						console
																							.log(
																								currentTime,
																								oldTime,
																								currentTime -
																								oldTime >
																								180000
																								);
																						if (currentTime -
																							oldTime >
																							180000
																							) {
																							uni.setStorageSync(
																								that
																								.DATA_KEY
																								.timeOld,
																								currentTime
																								);
																							that.wxRequest({
																								url: `${that.API}/fance/waybillFence/cronJsFance`,
																								method: 'POST',
																								data: {
																									vehicleNo: taskvalue
																										.vehicleNo,
																									driverTel: uni
																										.getStorageSync(
																											that
																											.DATA_KEY
																											.userInfo
																											)
																										.mobile,
																									trackType: 2,
																									driverId: uni
																										.getStorageSync(
																											that
																											.DATA_KEY
																											.userInfo
																											)
																										.driverId,
																									loadingOrderId: uni
																										.getStorageSync(
																											that
																											.DATA_KEY
																											.loadingOrderId
																											),
																									lat: data
																										.latitude,
																									lng: data
																										.longitude
																								},
																								success: res => {
																									console
																										.log(
																											res
																											)
																								}
																							});
																						}
																					}
																					);
																			},
																			fail: res => {
																				console
																					.log(
																						'获取位置失败',
																						res
																						);
																			}
																		});
																	}
																}
															});
														},
														fail(res) {
															uni.showModal({
																title: '"司机小程序"需要获取您的当前位置',
																content: '请点击设置->打开位置信息->使用小程序期间和离开小程序后',
																confirmText: '设置',
																showCancel: false,
																success(
																	res
																	) {
																	if (res
																		.confirm
																		) {
																		uni.openSetting({
																			success(
																				res
																				) {}
																		});
																	}
																}
															});
														}
													});
												}
											}
										});
										// #endif
										// #ifdef APP-PLUS
										if (uni.getSystemInfoSync().platform == 'android') {
											if (permision.checkSystemEnableLocation() ==
												false) {
												uni.showModal({
													title: '提示',
													content: '请开启手机gps定位,设置-隐私-位置',
													showCancel: false,
													success: function(res) {}
												});
												return;
											} else {
												if (result == 1) {
													that.$forceUpdate();
													islocation = true;
													locationModule.start({
															appSecurity: taskvalue
																.appSecurity,
															enterpriseSenderCode: taskvalue
																.enterpriseSenderCode,
															ShippingNoteNumber: taskvalue
																.loadingOrderId,
															StartCountrySubdivisionCode: taskvalue
																.shippingRegionCode,
															EndCountrySubdivisionCode: taskvalue
																.receiptRegionCode,
															StartLongitude: taskvalue
																.StartLongitude,
															StartLatitude: taskvalue
																.StartLatitude,
															EndLongitude: taskvalue
																.EndLongitude,
															EndLatitude: taskvalue
																.EndLatitude,
															StartLocationText: taskvalue
																.shippingCity,
															EndLocationText: taskvalue
																.receiptCity,
															VehicleNumber: taskvalue
																.vehicleNo,
															DriverName: taskvalue
																.driverName
														},
														ret => {
															let rets = ret.code;
															uni.getLocation({
																type: 'wgs84',
																success: function(
																	res) {
																	let longitude =
																		res
																		.longitude;
																	let latitude =
																		res
																		.latitude;
																	if (rets ==
																		'发送定位send成功'
																		) {
																		uni.setStorageSync(
																			'loadingOrderId',
																			taskvalue
																			.loadingOrderId
																			);
																		//发送定位回调
																		uni.request({
																			url: `https://sign.y2t.com/tax/taxInfoUpload`,
																			method: 'POST',
																			data: {
																				vehicleNumber: taskvalue
																					.vehicleNo,
																				driverName: taskvalue
																					.driverName,
																				shippingNoteNumber: taskvalue
																					.loadingOrderId,
																				longitude: longitude,
																				latitude: latitude,
																				status: 1
																			},
																			success: res => {
																				uni
																			.hideLoading();
																				console
																					.log(
																						'发送定位回调结果',
																						res
																						);
																			},
																			fail: error => {
																				uni
																			.hideLoading();
																				uni.showToast({
																					title: '网络异常！',
																					icon: 'none'
																				});
																			},
																			complete: res => {
																				if (obj
																					.complete
																					)
																					obj
																					.complete(
																						res
																						);
																			}
																		});
																		console
																			.log(
																				'====================================',
																				taskvalue
																				.loadingOrderId
																				);
																	}
																	//上传坐标点

																	that.wxRequest({
																		url: `${that.API}/fance/waybillFence/cronJsFance`,
																		method: 'POST',
																		data: {
																			vehicleNo: taskvalue
																				.vehicleNo,
																			driverTel: uni
																				.getStorageSync(
																					that
																					.DATA_KEY
																					.userInfo
																					)
																				.mobile,
																			trackType: 3,
																			driverId: uni
																				.getStorageSync(
																					that
																					.DATA_KEY
																					.userInfo
																					)
																				.driverId,
																			loadingOrderId: taskvalue
																				.loadingOrderId,
																			lat: latitude,
																			lng: longitude
																		},
																		success: res => {
																			console
																				.log(
																					res
																					)
																		}
																	});
																},
																fail: (err) => {
																	uni.showToast({
																		title: "位置定位失败，请查看定位权限是否开启",
																		icon: "none"
																	})
																}
															});
															console.log('发送定位结果', ret
															.code);
														}
													);
													that.Interval01 = setInterval(() => {

														// 调用异步方法启动定位
														console.log(
															'd======================调用异步方法启动定位 '
															);
														locationModule.start({
																appSecurity: taskvalue
																	.appSecurity,
																enterpriseSenderCode: taskvalue
																	.enterpriseSenderCode,
																ShippingNoteNumber: taskvalue
																	.loadingOrderId,
																StartCountrySubdivisionCode: taskvalue
																	.shippingRegionCode,
																EndCountrySubdivisionCode: taskvalue
																	.receiptRegionCode,
																StartLongitude: taskvalue
																	.StartLongitude,
																StartLatitude: taskvalue
																	.StartLatitude,
																EndLongitude: taskvalue
																	.EndLongitude,
																EndLatitude: taskvalue
																	.EndLatitude,
																StartLocationText: taskvalue
																	.shippingCity,
																EndLocationText: taskvalue
																	.receiptCity,
																VehicleNumber: taskvalue
																	.vehicleNo,
																DriverName: taskvalue
																	.driverName
															},
															ret => {
																let rets = ret
																.code;
																uni.getLocation({
																	type: 'wgs84',
																	success: function(
																		res
																		) {
																		let longitude =
																			res
																			.longitude;
																		let latitude =
																			res
																			.latitude;
																		uni.setStorageSync(
																			'loadingOrderId',
																			taskvalue
																			.loadingOrderId
																			);
																		if (rets ==
																			'发送定位send成功'
																			) {
																			// uni.setStorageSync('loadingOrderId', taskvalue.loadingOrderId);
																			//发送定位回调
																			uni.request({
																				url: `https://sign.y2t.com/tax/taxInfoUpload`,
																				method: 'POST',
																				data: {
																					vehicleNumber: taskvalue
																						.vehicleNo,
																					driverName: taskvalue
																						.driverName,
																					shippingNoteNumber: taskvalue
																						.loadingOrderId,
																					longitude: longitude,
																					latitude: latitude,
																					status: 1
																				},
																				success: res => {
																					uni
																				.hideLoading();
																					console
																						.log(
																							'发送定位回调结果',
																							res
																							);
																				},
																				fail: error => {
																					uni
																				.hideLoading();
																					uni.showToast({
																						title: '网络异常！',
																						icon: 'none'
																					});
																				},
																				complete: res => {
																					if (obj
																						.complete
																						)
																						obj
																						.complete(
																							res
																							);
																				}
																			});
																			console
																				.log(
																					'====================================',
																					taskvalue
																					.loadingOrderId
																					);
																		}

																		//上传坐标点
																		that.wxRequest({
																			url: `${that.API}/fance/waybillFence/cronJsFance`,
																			method: 'POST',
																			data: {
																				vehicleNo: taskvalue
																					.vehicleNo,
																				driverTel: uni
																					.getStorageSync(
																						that
																						.DATA_KEY
																						.userInfo
																						)
																					.mobile,
																				trackType: 3,
																				driverId: uni
																					.getStorageSync(
																						that
																						.DATA_KEY
																						.userInfo
																						)
																					.driverId,
																				loadingOrderId: uni
																					.getStorageSync(
																						that
																						.DATA_KEY
																						.loadingOrderId
																						),
																				lat: latitude,
																				lng: longitude
																			},
																			success: res => {
																				console
																					.log(
																						res
																						)
																			}
																		});
																	},
																	fail: err => {
																		uni.showToast({
																			title: "位置定位失败，请查看定位权限是否开启",
																			icon: "none"
																		})
																	}
																});
																console.log(
																	'发送定位结果',
																	ret.code);
																// uni.showModal({
																// 	title: '提示',
																// 	content: ret.code,
																// 	showCancel: false,
																// 	success: function(res) {
																// 		if (res.confirm) {
																// 			console.log('用户点击确定');
																// 		}
																// 	}
																// });
															}
														);
													}, 180000);
												} else {
													uni.showModal({
														title: '该程序需要获取您的当前位置',
														confirmText: '去授权',
														showCancel: false,
														success(res) {
															if (res.confirm) {
																permision
																	.gotoAppPermissionSetting();
															}
														}
													});
												}
											}
										} else if (uni.getSystemInfoSync().platform == 'ios') {
											islocation = true;
											locationModule.start({
													appSecurity: taskvalue.appSecurity,
													enterpriseSenderCode: taskvalue
														.enterpriseSenderCode,
													ShippingNoteNumber: taskvalue
														.loadingOrderId,
													StartCountrySubdivisionCode: taskvalue
														.shippingRegionCode,
													EndCountrySubdivisionCode: taskvalue
														.receiptRegionCode,
													StartLongitude: taskvalue
														.StartLongitude,
													StartLatitude: taskvalue.StartLatitude,
													EndLongitude: taskvalue.EndLongitude,
													EndLatitude: taskvalue.EndLatitude,
													StartLocationText: taskvalue
														.shippingCity,
													EndLocationText: taskvalue.receiptCity,
													VehicleNumber: taskvalue.vehicleNo,
													DriverName: taskvalue.driverName
												},
												ret => {
													let rets = ret.code;
													uni.getLocation({
														type: 'wgs84',
														success: function(res) {
															let longitude = res
																.longitude;
															let latitude = res
																.latitude;
															if (rets ==
																'发送定位send成功') {
																uni.setStorageSync(
																	'loadingOrderId',
																	taskvalue
																	.loadingOrderId
																	);
																//发送定位回调
																uni.request({
																	url: `https://sign.y2t.com/tax/taxInfoUpload`,
																	method: 'POST',
																	data: {
																		vehicleNumber: taskvalue
																			.vehicleNo,
																		driverName: taskvalue
																			.driverName,
																		shippingNoteNumber: taskvalue
																			.loadingOrderId,
																		longitude: longitude,
																		latitude: latitude,
																		status: 1
																	},
																	success: res => {
																		uni
																	.hideLoading();
																		console
																			.log(
																				'发送定位回调结果',
																				res
																				);
																	},
																	fail: error => {
																		uni
																	.hideLoading();
																		uni.showToast({
																			title: '网络异常！',
																			icon: 'none'
																		});
																	},
																	complete: res => {
																		if (obj
																			.complete
																			)
																			obj
																			.complete(
																				res
																				);
																	}
																});
																console.log(
																	'====================================',
																	taskvalue
																	.loadingOrderId
																	);
															}
															//上传坐标点

															that.wxRequest({
																url: `${that.API}/fance/waybillFence/cronJsFance`,
																method: 'POST',
																data: {
																	vehicleNo: taskvalue
																		.vehicleNo,
																	driverTel: uni
																		.getStorageSync(
																			that
																			.DATA_KEY
																			.userInfo
																			)
																		.mobile,
																	trackType: 3,
																	driverId: uni
																		.getStorageSync(
																			that
																			.DATA_KEY
																			.userInfo
																			)
																		.driverId,
																	loadingOrderId: taskvalue
																		.loadingOrderId,
																	lat: latitude,
																	lng: longitude
																},
																success: res => {
																	console
																		.log(
																			res
																			)
																}
															});
														},
														fail: (err) => {
															uni.showToast({
																title: "位置定位失败，请查看定位权限是否开启",
																icon: "none"
															})
														}
													});
													console.log('发送定位结果', ret.code);
												}
											);
											that.Interval01 = setInterval(() => {

												// 调用异步方法启动定位
												console.log(
													'd======================调用异步方法启动定位 '
													);
												locationModule.start({
														appSecurity: taskvalue
															.appSecurity,
														enterpriseSenderCode: taskvalue
															.enterpriseSenderCode,
														ShippingNoteNumber: taskvalue
															.loadingOrderId,
														StartCountrySubdivisionCode: taskvalue
															.shippingRegionCode,
														EndCountrySubdivisionCode: taskvalue
															.receiptRegionCode,
														StartLongitude: taskvalue
															.StartLongitude,
														StartLatitude: taskvalue
															.StartLatitude,
														EndLongitude: taskvalue
															.EndLongitude,
														EndLatitude: taskvalue
															.EndLatitude,
														StartLocationText: taskvalue
															.shippingCity,
														EndLocationText: taskvalue
															.receiptCity,
														VehicleNumber: taskvalue
															.vehicleNo,
														DriverName: taskvalue
															.driverName
													},
													ret => {
														let rets = ret.code;
														uni.getLocation({
															type: 'wgs84',
															success: function(
																res) {
																let longitude =
																	res
																	.longitude;
																let latitude =
																	res
																	.latitude;
																uni.setStorageSync(
																	'loadingOrderId',
																	taskvalue
																	.loadingOrderId
																	);
																if (rets ==
																	'发送定位send成功'
																	) {
																	// uni.setStorageSync('loadingOrderId', taskvalue.loadingOrderId);
																	//发送定位回调
																	uni.request({
																		url: `https://sign.y2t.com/tax/taxInfoUpload`,
																		method: 'POST',
																		data: {
																			vehicleNumber: taskvalue
																				.vehicleNo,
																			driverName: taskvalue
																				.driverName,
																			shippingNoteNumber: taskvalue
																				.loadingOrderId,
																			longitude: longitude,
																			latitude: latitude,
																			status: 1
																		},
																		success: res => {
																			uni
																		.hideLoading();
																			console
																				.log(
																					'发送定位回调结果',
																					res
																					);
																		},
																		fail: error => {
																			uni
																		.hideLoading();
																			uni.showToast({
																				title: '网络异常！',
																				icon: 'none'
																			});
																		},
																		complete: res => {
																			if (obj
																				.complete
																				)
																				obj
																				.complete(
																					res
																					);
																		}
																	});
																	console
																		.log(
																			'====================================',
																			taskvalue
																			.loadingOrderId
																			);
																}

																//上传坐标点
																that.wxRequest({
																	url: `${that.API}/fance/waybillFence/cronJsFance`,
																	method: 'POST',
																	data: {
																		vehicleNo: taskvalue
																			.vehicleNo,
																		driverTel: uni
																			.getStorageSync(
																				that
																				.DATA_KEY
																				.userInfo
																				)
																			.mobile,
																		trackType: 3,
																		driverId: uni
																			.getStorageSync(
																				that
																				.DATA_KEY
																				.userInfo
																				)
																			.driverId,
																		loadingOrderId: taskvalue
																			.loadingOrderId,
																		lat: latitude,
																		lng: longitude
																	},
																	success: res => {
																		console
																			.log(
																				res
																				)
																	}
																});
															},
															fail: err => {
																uni.showToast({
																	title: "位置定位失败，请查看定位权限是否开启",
																	icon: "none"
																})
															}
														});
														console.log('发送定位结果', ret
															.code);
													}
												);
											}, 180000);

										}
										// #endif
									}
								}
							});
						}
					});
				}
				// #endif

				// #ifdef MP-WEIXIN
				uni.getSystemInfo({
					success: res => {
						var isopendingwei = res.locationEnabled;
						if (isopendingwei == false) {
							uni.showModal({
								title: '提示',
								content: '请开启手机gps定位,设置-隐私-位置',
								showCancel: false,
								success: function(res) {}
							});
						} else {
							that.wxRequest({
								url: `${that.API}/miniApp/loadingOrder/receive`,
								method: 'POST',
								data: {
									// #ifdef MP-WEIXIN
									clickLocation: 3,
									// #endif
									// #ifdef APP-PLUS
									clickLocation: 1,
									// #endif
									loadingOrderId: that.scanloadingOrderId,
								},
								title: '接单中...',
								success: res => {
									uni.showToast({
										title: '抢单成功！',
										icon: 'none'
									});
									that.$refs.popup5.close();
									that.page = 1;
									that.onwaybill(that.mescroll);

									that.wxRequest({
										url: `${that.API}/fance/waybillFence/createCircleFenceIsSuccess?waybillId=${uni.getStorageSync(this.DATA_KEY.waybillId)}`,
										method: 'get',
										title: '加载中...',
										success: res => {
											if (res.data.data.fenceStatus == 1) {
												let islocation = false;
												//获取位置后台定位授权
												uni.authorize({
													scope: 'scope.userLocationBackground',
													success(infoRes) {
														uni.getSetting({
															success(
																res
																) {
																that
															.$forceUpdate();
																if (!
																	res
																	.authSetting[
																		'scope.userLocationBackground'
																		]
																	) {
																	uni.showModal({
																		title: '"司机小程序"需要获取您的当前位置',
																		content: '请点击设置->打开位置信息->使用小程序期间和离开小程序后',
																		confirmText: '设置',
																		showCancel: false,
																		success(
																			res
																			) {
																			if (res
																				.confirm
																				) {
																				uni.openSetting({
																					success(
																						res
																						) {}
																				});
																			}
																		}
																	});
																} else {
																	islocation
																		=
																		true;
																	uni.setStorageSync(
																		that
																		.DATA_KEY
																		.loadingOrderId,
																		that
																		.scanloadingOrderId
																		);
																	wx.startLocationUpdateBackground({
																		success: res => {
																			console
																				.log(
																					res
																					)
																			wx.onLocationChange(
																				data => {
																					var currentTime =
																						new Date()
																						.getTime();
																					var oldTime =
																						uni
																						.getStorageSync(
																							that
																							.DATA_KEY
																							.timeOld
																							);
																					console
																						.log(
																							currentTime,
																							oldTime,
																							currentTime -
																							oldTime >
																							180000
																							);
																					if (currentTime -
																						oldTime >
																						180000
																						) {
																						uni.setStorageSync(
																							that
																							.DATA_KEY
																							.timeOld,
																							currentTime
																							);
																						that.wxRequest({
																							url: `${that.API}/fance/waybillFence/cronJsFance`,
																							method: 'POST',
																							data: {
																								vehicleNo: taskvalue
																									.vehicleNo,
																								driverTel: uni
																									.getStorageSync(
																										that
																										.DATA_KEY
																										.userInfo
																										)
																									.mobile,
																								trackType: 2,
																								driverId: uni
																									.getStorageSync(
																										that
																										.DATA_KEY
																										.userInfo
																										)
																									.driverId,
																								loadingOrderId: uni
																									.getStorageSync(
																										that
																										.DATA_KEY
																										.loadingOrderId
																										),
																								lat: data
																									.latitude,
																								lng: data
																									.longitude
																							},
																							success: res => {
																								console
																									.log(
																										res
																										)
																							}
																						});
																					}
																				}
																				);
																		},
																		fail: res => {
																			console
																				.log(
																					'获取位置失败',
																					res
																					);
																		}
																	});
																}
															}
														});
													},
													fail(res) {
														uni.showModal({
															title: '"司机小程序"需要获取您的当前位置',
															content: '请点击设置->打开位置信息->使用小程序期间和离开小程序后',
															confirmText: '设置',
															showCancel: false,
															success(
																res
																) {
																if (res
																	.confirm
																	) {
																	uni.openSetting({
																		success(
																			res
																			) {}
																	});
																}
															}
														});
													}
												});
											}
										}
									})
								}
							})
						}
					}
				})
				// #endif

				return
				that.wxRequest({
					url: `${that.API}/miniApp/loadingOrder/receive`,
					method: 'POST',
					data: {
						// #ifdef MP-WEIXIN
						clickLocation: 3,
						// #endif
						// #ifdef APP-PLUS
						clickLocation: 1,
						// #endif
						loadingOrderId: that.scanloadingOrderId,
					},
					title: '接单中...',
					success: res => {
						uni.showToast({
							title: '抢单成功！',
							icon: 'none'
						});
						that.$refs.popup5.close();
						that.page = 1;
						that.onwaybill(that.mescroll);


						that.wxRequest({
							url: `${that.API}/fance/waybillFence/createCircleFenceIsSuccess?waybillId=${uni.getStorageSync(this.DATA_KEY.waybillId)}`,
							method: 'get',
							title: '加载中...',
							success: res => {
								console.log(res.data)
								console.log(!res.data.data)
								if (res.data.data.fenceStatus == 1) {
									let islocation = false;
									// #ifdef MP-WEIXIN
									//获取位置后台定位授权
									uni.authorize({
										scope: 'scope.userLocationBackground',
										success(infoRes) {
											uni.getSetting({
												success(res) {
													that.$forceUpdate();
													if (!res.authSetting[
															'scope.userLocationBackground'
															]) {
														uni.showModal({
															title: '"司机小程序"需要获取您的当前位置',
															content: '请点击设置->打开位置信息->使用小程序期间和离开小程序后',
															confirmText: '设置',
															showCancel: false,
															success(
																res) {
																if (res
																	.confirm
																	) {
																	uni.openSetting({
																		success(
																			res
																			) {}
																	});
																}
															}
														});
													} else {
														islocation = true;
														uni.setStorageSync(that
															.DATA_KEY
															.loadingOrderId,
															that
															.scanloadingOrderId
															);
														wx.startLocationUpdateBackground({
															success: res => {
																console
																	.log(
																		res
																		)
																wx.onLocationChange(
																	data => {
																		var currentTime =
																			new Date()
																			.getTime();
																		var oldTime =
																			uni
																			.getStorageSync(
																				that
																				.DATA_KEY
																				.timeOld
																				);
																		console
																			.log(
																				currentTime,
																				oldTime,
																				currentTime -
																				oldTime >
																				180000
																				);
																		if (currentTime -
																			oldTime >
																			180000
																			) {
																			uni.setStorageSync(
																				that
																				.DATA_KEY
																				.timeOld,
																				currentTime
																				);
																			that.wxRequest({
																				url: `${that.API}/fance/waybillFence/cronJsFance`,
																				method: 'POST',
																				data: {
																					vehicleNo: taskvalue
																						.vehicleNo,
																					driverTel: uni
																						.getStorageSync(
																							that
																							.DATA_KEY
																							.userInfo
																							)
																						.mobile,
																					trackType: 2,
																					driverId: uni
																						.getStorageSync(
																							that
																							.DATA_KEY
																							.userInfo
																							)
																						.driverId,
																					loadingOrderId: uni
																						.getStorageSync(
																							that
																							.DATA_KEY
																							.loadingOrderId
																							),
																					lat: data
																						.latitude,
																					lng: data
																						.longitude
																				},
																				success: res => {
																					console
																						.log(
																							res
																							)
																				}
																			});
																		}
																	}
																	);
															},
															fail: res => {
																console
																	.log(
																		'获取位置失败',
																		res
																		);
															}
														});
													}
												}
											});
										},
										fail(res) {
											uni.showModal({
												title: '"司机小程序"需要获取您的当前位置',
												content: '请点击设置->打开位置信息->使用小程序期间和离开小程序后',
												confirmText: '设置',
												showCancel: false,
												success(res) {
													if (res.confirm) {
														uni.openSetting({
															success(
																res) {}
														});
													}
												}
											});
										}
									});
									// #endif
									// #ifdef APP-PLUS
									if (uni.getSystemInfoSync().platform == 'android') {
										if (permision.checkSystemEnableLocation() == false) {
											uni.showModal({
												title: '提示',
												content: '请开启手机gps定位,设置-隐私-位置',
												showCancel: false,
												success: function(res) {}
											});
											return;
										} else {
											if (result == 1) {
												that.$forceUpdate();
												islocation = true;
												locationModule.start({
														appSecurity: taskvalue.appSecurity,
														enterpriseSenderCode: taskvalue
															.enterpriseSenderCode,
														ShippingNoteNumber: taskvalue
															.loadingOrderId,
														StartCountrySubdivisionCode: taskvalue
															.shippingRegionCode,
														EndCountrySubdivisionCode: taskvalue
															.receiptRegionCode,
														StartLongitude: taskvalue
															.StartLongitude,
														StartLatitude: taskvalue
															.StartLatitude,
														EndLongitude: taskvalue
															.EndLongitude,
														EndLatitude: taskvalue.EndLatitude,
														StartLocationText: taskvalue
															.shippingCity,
														EndLocationText: taskvalue
															.receiptCity,
														VehicleNumber: taskvalue.vehicleNo,
														DriverName: taskvalue.driverName
													},
													ret => {
														let rets = ret.code;
														uni.getLocation({
															type: 'wgs84',
															success: function(
															res) {
																let longitude =
																	res
																	.longitude;
																let latitude =
																	res
																	.latitude;
																if (rets ==
																	'发送定位send成功'
																	) {
																	uni.setStorageSync(
																		'loadingOrderId',
																		taskvalue
																		.loadingOrderId
																		);
																	//发送定位回调
																	uni.request({
																		url: `https://sign.y2t.com/tax/taxInfoUpload`,
																		method: 'POST',
																		data: {
																			vehicleNumber: taskvalue
																				.vehicleNo,
																			driverName: taskvalue
																				.driverName,
																			shippingNoteNumber: taskvalue
																				.loadingOrderId,
																			longitude: longitude,
																			latitude: latitude,
																			status: 1
																		},
																		success: res => {
																			uni
																		.hideLoading();
																			console
																				.log(
																					'发送定位回调结果',
																					res
																					);
																		},
																		fail: error => {
																			uni
																		.hideLoading();
																			uni.showToast({
																				title: '网络异常！',
																				icon: 'none'
																			});
																		},
																		complete: res => {
																			if (obj
																				.complete
																				)
																				obj
																				.complete(
																					res
																					);
																		}
																	});
																	console
																		.log(
																			'====================================',
																			taskvalue
																			.loadingOrderId
																			);
																}
																//上传坐标点

																that.wxRequest({
																	url: `${that.API}/fance/waybillFence/cronJsFance`,
																	method: 'POST',
																	data: {
																		vehicleNo: taskvalue
																			.vehicleNo,
																		driverTel: uni
																			.getStorageSync(
																				that
																				.DATA_KEY
																				.userInfo
																				)
																			.mobile,
																		trackType: 3,
																		driverId: uni
																			.getStorageSync(
																				that
																				.DATA_KEY
																				.userInfo
																				)
																			.driverId,
																		loadingOrderId: taskvalue
																			.loadingOrderId,
																		lat: latitude,
																		lng: longitude
																	},
																	success: res => {
																		console
																			.log(
																				res
																				)
																	}
																});
															},
															fail: (err) => {
																uni.showToast({
																	title: "位置定位失败，请查看定位权限是否开启",
																	icon: "none"
																})
															}
														});
														console.log('发送定位结果', ret.code);
													}
												);
												that.Interval01 = setInterval(() => {

													// 调用异步方法启动定位
													console.log(
														'd======================调用异步方法启动定位 '
														);
													locationModule.start({
															appSecurity: taskvalue
																.appSecurity,
															enterpriseSenderCode: taskvalue
																.enterpriseSenderCode,
															ShippingNoteNumber: taskvalue
																.loadingOrderId,
															StartCountrySubdivisionCode: taskvalue
																.shippingRegionCode,
															EndCountrySubdivisionCode: taskvalue
																.receiptRegionCode,
															StartLongitude: taskvalue
																.StartLongitude,
															StartLatitude: taskvalue
																.StartLatitude,
															EndLongitude: taskvalue
																.EndLongitude,
															EndLatitude: taskvalue
																.EndLatitude,
															StartLocationText: taskvalue
																.shippingCity,
															EndLocationText: taskvalue
																.receiptCity,
															VehicleNumber: taskvalue
																.vehicleNo,
															DriverName: taskvalue
																.driverName
														},
														ret => {
															let rets = ret.code;
															uni.getLocation({
																type: 'wgs84',
																success: function(
																	res
																	) {
																	let longitude =
																		res
																		.longitude;
																	let latitude =
																		res
																		.latitude;
																	uni.setStorageSync(
																		'loadingOrderId',
																		taskvalue
																		.loadingOrderId
																		);
																	if (rets ==
																		'发送定位send成功'
																		) {
																		// uni.setStorageSync('loadingOrderId', taskvalue.loadingOrderId);
																		//发送定位回调
																		uni.request({
																			url: `https://sign.y2t.com/tax/taxInfoUpload`,
																			method: 'POST',
																			data: {
																				vehicleNumber: taskvalue
																					.vehicleNo,
																				driverName: taskvalue
																					.driverName,
																				shippingNoteNumber: taskvalue
																					.loadingOrderId,
																				longitude: longitude,
																				latitude: latitude,
																				status: 1
																			},
																			success: res => {
																				uni
																			.hideLoading();
																				console
																					.log(
																						'发送定位回调结果',
																						res
																						);
																			},
																			fail: error => {
																				uni
																			.hideLoading();
																				uni.showToast({
																					title: '网络异常！',
																					icon: 'none'
																				});
																			},
																			complete: res => {
																				if (obj
																					.complete
																					)
																					obj
																					.complete(
																						res
																						);
																			}
																		});
																		console
																			.log(
																				'====================================',
																				taskvalue
																				.loadingOrderId
																				);
																	}

																	//上传坐标点
																	that.wxRequest({
																		url: `${that.API}/fance/waybillFence/cronJsFance`,
																		method: 'POST',
																		data: {
																			vehicleNo: taskvalue
																				.vehicleNo,
																			driverTel: uni
																				.getStorageSync(
																					that
																					.DATA_KEY
																					.userInfo
																					)
																				.mobile,
																			trackType: 3,
																			driverId: uni
																				.getStorageSync(
																					that
																					.DATA_KEY
																					.userInfo
																					)
																				.driverId,
																			loadingOrderId: uni
																				.getStorageSync(
																					that
																					.DATA_KEY
																					.loadingOrderId
																					),
																			lat: latitude,
																			lng: longitude
																		},
																		success: res => {
																			console
																				.log(
																					res
																					)
																		}
																	});
																},
																fail: err => {
																	uni.showToast({
																		title: "位置定位失败，请查看定位权限是否开启",
																		icon: "none"
																	})
																}
															});
															console.log('发送定位结果',
																ret.code);
															// uni.showModal({
															// 	title: '提示',
															// 	content: ret.code,
															// 	showCancel: false,
															// 	success: function(res) {
															// 		if (res.confirm) {
															// 			console.log('用户点击确定');
															// 		}
															// 	}
															// });
														}
													);
												}, 180000);
											} else {
												uni.showModal({
													title: '该程序需要获取您的当前位置',
													confirmText: '去授权',
													showCancel: false,
													success(res) {
														if (res.confirm) {
															permision
																.gotoAppPermissionSetting();
														}
													}
												});
											}
										}
									} else if (uni.getSystemInfoSync().platform == 'ios') {
										islocation = true;
										locationModule.start({
												appSecurity: taskvalue.appSecurity,
												enterpriseSenderCode: taskvalue
													.enterpriseSenderCode,
												ShippingNoteNumber: taskvalue
													.loadingOrderId,
												StartCountrySubdivisionCode: taskvalue
													.shippingRegionCode,
												EndCountrySubdivisionCode: taskvalue
													.receiptRegionCode,
												StartLongitude: taskvalue.StartLongitude,
												StartLatitude: taskvalue.StartLatitude,
												EndLongitude: taskvalue.EndLongitude,
												EndLatitude: taskvalue.EndLatitude,
												StartLocationText: taskvalue.shippingCity,
												EndLocationText: taskvalue.receiptCity,
												VehicleNumber: taskvalue.vehicleNo,
												DriverName: taskvalue.driverName
											},
											ret => {
												let rets = ret.code;
												uni.getLocation({
													type: 'wgs84',
													success: function(res) {
														let longitude = res
															.longitude;
														let latitude = res
															.latitude;
														if (rets ==
															'发送定位send成功') {
															uni.setStorageSync(
																'loadingOrderId',
																taskvalue
																.loadingOrderId
																);
															//发送定位回调
															uni.request({
																url: `https://sign.y2t.com/tax/taxInfoUpload`,
																method: 'POST',
																data: {
																	vehicleNumber: taskvalue
																		.vehicleNo,
																	driverName: taskvalue
																		.driverName,
																	shippingNoteNumber: taskvalue
																		.loadingOrderId,
																	longitude: longitude,
																	latitude: latitude,
																	status: 1
																},
																success: res => {
																	uni
																.hideLoading();
																	console
																		.log(
																			'发送定位回调结果',
																			res
																			);
																},
																fail: error => {
																	uni
																.hideLoading();
																	uni.showToast({
																		title: '网络异常！',
																		icon: 'none'
																	});
																},
																complete: res => {
																	if (obj
																		.complete
																		)
																		obj
																		.complete(
																			res
																			);
																}
															});
															console.log(
																'====================================',
																taskvalue
																.loadingOrderId
																);
														}
														//上传坐标点

														that.wxRequest({
															url: `${that.API}/fance/waybillFence/cronJsFance`,
															method: 'POST',
															data: {
																vehicleNo: taskvalue
																	.vehicleNo,
																driverTel: uni
																	.getStorageSync(
																		that
																		.DATA_KEY
																		.userInfo
																		)
																	.mobile,
																trackType: 3,
																driverId: uni
																	.getStorageSync(
																		that
																		.DATA_KEY
																		.userInfo
																		)
																	.driverId,
																loadingOrderId: taskvalue
																	.loadingOrderId,
																lat: latitude,
																lng: longitude
															},
															success: res => {
																console
																	.log(
																		res
																		)
															}
														});
													},
													fail: (err) => {
														uni.showToast({
															title: "位置定位失败，请查看定位权限是否开启",
															icon: "none"
														})
													}
												});
												console.log('发送定位结果', ret.code);
											}
										);
										that.Interval01 = setInterval(() => {

											// 调用异步方法启动定位
											console.log(
												'd======================调用异步方法启动定位 '
												);
											locationModule.start({
													appSecurity: taskvalue
														.appSecurity,
													enterpriseSenderCode: taskvalue
														.enterpriseSenderCode,
													ShippingNoteNumber: taskvalue
														.loadingOrderId,
													StartCountrySubdivisionCode: taskvalue
														.shippingRegionCode,
													EndCountrySubdivisionCode: taskvalue
														.receiptRegionCode,
													StartLongitude: taskvalue
														.StartLongitude,
													StartLatitude: taskvalue
														.StartLatitude,
													EndLongitude: taskvalue
														.EndLongitude,
													EndLatitude: taskvalue
														.EndLatitude,
													StartLocationText: taskvalue
														.shippingCity,
													EndLocationText: taskvalue
														.receiptCity,
													VehicleNumber: taskvalue
														.vehicleNo,
													DriverName: taskvalue
														.driverName
												},
												ret => {
													let rets = ret.code;
													uni.getLocation({
														type: 'wgs84',
														success: function(
															res) {
															let longitude =
																res
																.longitude;
															let latitude =
																res
																.latitude;
															uni.setStorageSync(
																'loadingOrderId',
																taskvalue
																.loadingOrderId
																);
															if (rets ==
																'发送定位send成功'
																) {
																// uni.setStorageSync('loadingOrderId', taskvalue.loadingOrderId);
																//发送定位回调
																uni.request({
																	url: `https://sign.y2t.com/tax/taxInfoUpload`,
																	method: 'POST',
																	data: {
																		vehicleNumber: taskvalue
																			.vehicleNo,
																		driverName: taskvalue
																			.driverName,
																		shippingNoteNumber: taskvalue
																			.loadingOrderId,
																		longitude: longitude,
																		latitude: latitude,
																		status: 1
																	},
																	success: res => {
																		uni
																	.hideLoading();
																		console
																			.log(
																				'发送定位回调结果',
																				res
																				);
																	},
																	fail: error => {
																		uni
																	.hideLoading();
																		uni.showToast({
																			title: '网络异常！',
																			icon: 'none'
																		});
																	},
																	complete: res => {
																		if (obj
																			.complete
																			)
																			obj
																			.complete(
																				res
																				);
																	}
																});
																console
																	.log(
																		'====================================',
																		taskvalue
																		.loadingOrderId
																		);
															}

															//上传坐标点
															that.wxRequest({
																url: `${that.API}/fance/waybillFence/cronJsFance`,
																method: 'POST',
																data: {
																	vehicleNo: taskvalue
																		.vehicleNo,
																	driverTel: uni
																		.getStorageSync(
																			that
																			.DATA_KEY
																			.userInfo
																			)
																		.mobile,
																	trackType: 3,
																	driverId: uni
																		.getStorageSync(
																			that
																			.DATA_KEY
																			.userInfo
																			)
																		.driverId,
																	loadingOrderId: taskvalue
																		.loadingOrderId,
																	lat: latitude,
																	lng: longitude
																},
																success: res => {
																	console
																		.log(
																			res
																			)
																}
															});
														},
														fail: err => {
															uni.showToast({
																title: "位置定位失败，请查看定位权限是否开启",
																icon: "none"
															})
														}
													});
													console.log('发送定位结果', ret
													.code);
												}
											);
										}, 180000);

									}
									// #endif
								}
							}
						});
					}
				});

				// if (that.projectCode == '') {
				// 	uni.showToast({
				// 		title: '验证码获取错误,请重新获取',
				// 		icon: 'none'
				// 	});
				// 	return;
				// }
				// if (that.checkCode == '') {
				// 	uni.showToast({
				// 		title: '请输入验证码',
				// 		icon: 'none'
				// 	});
				// 	return;
				// }
				// uni.request({
				// 	// 获取ip
				// 	url: 'https://pv.sohu.com/cityjson?ie=utf-8',
				// 	success(res) {
				// 		var m = JSON.parse(res.data.match(/.*(\{[^\}]+\}).*/)[1] || '{}');
				// 		let ip = m.cip;
				// 		console.log('ip =>', m.cip, res);
				// 		that.wxRequest({
				// 			url: `${that.API}/miniApp/loadingOrder/driverSignContract`,
				// 			method: 'POST',
				// 			data: {
				// 				loadingOrderId: that.scanloadingOrderId,
				// 				code: that.checkCode,
				// 				projectCode: that.projectCode,
				// 				ip: ip
				// 			},
				// 			title: '验证签约中...',
				// 			success: res => {
				// 				uni.showToast({
				// 					title: '抢单成功！',
				// 					icon: 'none'
				// 				});
				// 				that.$refs.popup5.close();
				// 				that.onwaybill(null);
				// 			}
				// 		});
				// 	}
				// });
			},
			mescrollInit(mescroll) {
				this.mescroll = mescroll;
			},
			/*下拉刷新的回调*/
			downCallback(mescroll) {
				this.page = 0;
				mescroll.resetUpScroll(); // 重置列表为第一页 (自动执行 page.num=1, 再触发upCallback方法 )
			},
			/*上拉加载的回调*/
			upCallback(mescroll) {
				this.page = this.page + 1; // 页码, 默认从1开始
				//联网加载数据
				this.onwaybill(mescroll);
			},
			stauscolor: function(staus) {
				let color = '#2B7CFF';
				if (staus == 0) {
					color = '#2B7CFF';
				} else if (staus == 1) {
					color = '#FB8536';
				} else if (staus == 2) {
					color = '#81D487';
				}
				return color;
			},
			staustext: function(staus) {
				let text = '待起运';
				if (staus == 0) {
					text = '待起运';
				} else if (staus == 1) {
					text = '已起运';
				} else if (staus == 2) {
					text = '已送达';
				}
				return text;
			},
			onSubscribeMessage() {
				//获取用户的当前设置
				uni.getSetting({
					//是否同时获取用户订阅消息的订阅状态
					withSubscriptions: true,
					success(res) {
						if (res.subscriptionsSetting.mainSwitch == true) {
							// uni.requestSubscribeMessage({
							// 	tmplIds: ['1XVivLfWx3FXmj1GIuQP0dI31xOTQkGoTqUoB1XqcKY'],
							// 	success(res) {
							// 		console.log('1============>', res);
							// 	}
							// });
							if (res.subscriptionsSetting.itemSettings != null && res.subscriptionsSetting
								.itemSettings['1XVivLfWx3FXmj1GIuQP0dI31xOTQkGoTqUoB1XqcKY'] != null) {
								//是否总是记住
								if (res.subscriptionsSetting.itemSettings[
										'1XVivLfWx3FXmj1GIuQP0dI31xOTQkGoTqUoB1XqcKY'] != 'accept') {
									//是否允许（否）
									uni.showModal({
										title: '"司机小程序"需要您授权接收订阅通知！',
										// content: '请点击设置->打开位置信息->使用小程序期间和离开小程序后',
										confirmText: '去设置',
										showCancel: false,
										success(res) {
											if (res.confirm) {
												uni.openSetting({
													success(res) {}
												});
											}
										}
									});
								}
							} else {
								//订阅消息
								uni.requestSubscribeMessage({
									//需要订阅的消息模板的id的集合，一次调用最多可订阅3条消息
									tmplIds: ['1XVivLfWx3FXmj1GIuQP0dI31xOTQkGoTqUoB1XqcKY'],
									success(res) {
										// uni.setStorageSync(this.DATA_KEY.issubscription, idPhotoUp);
									}
								});
							}
						} else {
							uni.showModal({
								title: '"司机小程序"需要您授权接收订阅消息！',
								// content: '请点击设置->打开位置信息->使用小程序期间和离开小程序后',
								confirmText: '去设置',
								showCancel: false,
								success(res) {
									if (res.confirm) {
										uni.openSetting({
											success(res) {}
										});
									}
								}
							});
						}
					}
				});
			},
			onvehicle: function(index) {
				this.current = index;
			},
			deleteImage: function(e) {
				this.imageurl = e.allImages;
			},
			addImage: function(e) {
				console.log(e)
				this.imageurl = e.allImages;
			},
			onfav(item) { //浮窗
				for (let i = 0; i < this.tasklist.length; i++) {
					if (item.loadingOrderId == this.tasklist[i].loadingOrderId) {
						this.tasklist[i].iscustNo = this.tasklist[i].iscustNo == 0 ? 1 : 0
					}
				}
			},
			scanAdd: function() {
				let that = this;
				that.wxRequest({
					url: `${that.API}/miniApp/loadingOrder/getVehiclesByLoadingOrder`,
					method: 'POST',
					data: {
						waybillId: that.scanwaybillId,
						platenNum: that.platenNum
					},
					success: res => {
						that.issign(that.scanwaybillId, '', that.platenNum, 1);
					}
				});

				// this.$refs.popup1.close();
				// this.wxRequest({
				// 	url: `${this.API}/miniApp/loadingOrder/scanAdd`,
				// 	method: 'POST',
				// 	data: {
				// 		waybillId: this.scanwaybillId,
				// 		vehicleId: this.vehiclelist[this.current].vehicleInfoId
				// 	},
				// 	success: res => {
				// 		uni.showToast({
				// 			title: '抢单成功！',
				// 			icon: 'none'
				// 		});
				// 		this.onwaybill(null);
				// 	}
				// });
			},
			issign(scanwaybillId, loadingOrderId, platenNum, model) {
				console.log(uni.getStorageSync(this.DATA_KEY.taskvalue))
				console.log('========scanwaybillId==============', scanwaybillId);
				console.log('========loadingOrderId==============', loadingOrderId);
				let that = this;
				that.wxRequest({
					url: `${that.API}/miniApp/loadingOrder/checkVehicleReal`,
					method: 'POST',
					data: {
						// #ifdef MP-WEIXIN
						clickLocation: "2",
						// #endif
						// #ifdef APP-PLUS
						clickLocation: "1",
						// #endif
						waybillId: scanwaybillId,
						plateNum: platenNum,
						loadingOrderId: loadingOrderId,
						model: model
					},
					success: res => {
						/* if (res.data.data.realnameState == 0) {
							uni.showToast({
								title: '司机未实名,请先进行实名操作！',
								icon: 'none'
							});
							return;
						}
						if (res.data.data.licenseState == 0) {
							uni.showToast({
								title: '车辆未认证,请先进行认证操作或更换车辆！',
								icon: 'none'
							});
							return;
						} */
						that.$refs.popup1.close();
						that.ispopup1 = false;
						that.$nextTick(() => {
							that.ispopup1 = true;
						});
						loadingOrderId = res.data.data.loadingOrderId;
						that.scanloadingOrderId = res.data.data.loadingOrderId;
						that.$refs.popup5.open('center');

						if (scanwaybillId) {
							that.wxRequest({
								url: `${that.API}/miniApp/loadingOrder/getLoadingOrder?loadingOrderId=${res.data.data.loadingOrderId}`,
								method: 'get',
								title: '加载中...',
								success: res => {
									let taskvalue = res.data.data
									uni.setStorageSync(that.DATA_KEY.taskvalue, taskvalue)
									uni.setStorageSync(that.DATA_KEY.waybillId, scanwaybillId)
								}
							});
						}
						// if (res.data.data.signState == 0) {

						// 	that.checkCode = '';
						// 	that.$refs.popup5.open('center');
						// } else {
						// 	that.wxRequest({
						// 		url: `${that.API}/miniApp/loadingOrder/receive`,
						// 		method: 'POST',
						// 		data: {
						// 			loadingOrderId: loadingOrderId
						// 		},
						// 		title: '接单中...',
						// 		success: res => {
						// 			that.onwaybill(null);
						// 		}
						// 	});
						// }
					}
				});
			},
			onHistoricalwaybill() {
				uni.navigateTo({
					url: `../personal/waybilllist`
				});
			},
			onCarrier() {
				uni.navigateTo({
					url: '../task/carrier'
				});
			},
			jumpdaiban(){
				uni.navigateTo({
					url: `/pages/message/index?type=daiban`
				});
				
			},
			onscan() {
				// this.$refs.popup5.open('center');
				// return;
				// if (this.tasklist.length > 0 && this.tasklist[0].billStatus == 2) {
				// 	uni.showModal({
				// 		title: '当前有正在进行中的任务',
				// 		content: '请完成任务后再次扫码抢单',
				// 		showCancel: false,
				// 		success: function(res) {}
				// 	});
				// 	return;
				// }
				if (!this.userInfo.mobile) {
					uni.showModal({
						title: '登录',
						content: '您尚未登录,立即去登录！',
						success: (res) => {
							if (res.confirm) {
								this.onLogin();
							}
						}
					});
					return;
				}
				let that = this;
				that.ishine = true;
				uni.scanCode({
					scanType: ['qrCode'],
					success: function(res) {
						let urlresult = res.result;
						console.log("d===========>", urlresult);
						let url = urlresult.split('?')[1];
						let isvo = that.getQueryVariable(url, 'isvo');
						if (isvo == 0) {
							//0邀请

							let etpId = that.getQueryVariable(url, 'etpId');
							let etpName = that.getQueryVariable(url, 'etpName');
							let exemptCode = that.getQueryVariable(url, 'exemptCode');

							let isetp = false;
							that.wxRequest({
								url: `${that.API}/driverService/checkInvitationCode`,
								method: 'POST',
								data: {
									driverId: uni.getStorageSync(that.DATA_KEY.userInfo).driverId,
									etpId: etpId,
									exemptCode: exemptCode
								},
								success: res => {
									if (that.userInfo.idcard == '') {
										uni.navigateTo({
											url: '../personal/driverregistration?etpId=' +
												etpId + '&etpName=' + etpName +
												'&exemptCode=' + exemptCode
										});
										return;
									}
									if (res.data.data.status == 1) {
										isetp = true;
										uni.showToast({
											title: '您已加入该企业！',
											icon: 'none'
										});
										//车辆列表
										uni.navigateTo({
											url: `/pages/vehicle/vehiclelist`
										});
									} else {
										uni.navigateTo({
											url: '../task/joincarrier?etpId=' + etpId +
												'&etpName=' + etpName + '&exemptCode=' +
												exemptCode
										});
									}
								}
							});
							// if (!isetp) {
							// 	uni.navigateTo({
							// 		url: '../task/joincarrier?etpId=' + etpId + '&etpName=' + etpName + '&exemptCode=' + exemptCode
							// 	});
							// } else {
							// 	//车辆列表
							// 	uni.navigateTo({
							// 		url: `../personal/vehiclelist`
							// 	});
							// }
						} else if (isvo == 1) {
							that.isscan = true;
							//抢单
							that.wxRequest({
								url: `${that.API}/driverService/checkQualifications`,
								method: 'POST',
								title: '加载中...',
								data: {
									driverId: uni.getStorageSync(that.DATA_KEY.userInfo).driverId,
									etpId: uni.getStorageSync(that.DATA_KEY.etpId),
									waybillId: urlresult.split('=')[2]
								},
								success: res => {
									that.isValidCont = res.data.data.isValidCont;
									uni.setStorageSync(that.DATA_KEY.platformCoNo, res.data.data
										.platformCoNo);
									if (!res.data.data.flag) {
										that.onrealverif(res);
									} else {
										that.scanwaybillId = urlresult.split('=')[2];
										that.wxRequest({
											url: `${that.API}/blacklist/queryBlacklist`,
											method: 'POST',
											data: {
												etpId: uni.getStorageSync(that.DATA_KEY
													.etpId),
												typeId: "1", //id类型 1司机 2车辆
												driverVehicleId: uni.getStorageSync(that
													.DATA_KEY.userInfo).driverId
											},
											success(res) {
												if (res.data.data) {
													uni.showModal({
														title: '禁止接单',
														content: `您已被${uni.getStorageSync(that.DATA_KEY.etpName)}列为黑名单`,
														showCancel: false,
														confirmText: '确定',
														confirmColor: '#49A9F0',
														success: function(res) {

														}
													});
												} else {
													that.onqrcode();
												}
											}
										});


										// that.scanwaybillId = urlresult.split('=')[2];
										// that.onqrcode();
									}
								}
							});
						}
					}
				});

				// if (this.userInfo.idcard == '') {
				// 	uni.showModal({
				// 		title: '注册司机信息',
				// 		content: '您尚未注册司机信息,立即去注册司机信息！',
				// 		success: function(res) {
				// 			if (res.confirm) {
				// 				uni.navigateTo({
				// 					url: `../personal/driverregistration`
				// 				});
				// 			}
				// 		}
				// 	});
				// 	return;
				// }
			},
			onqrcode: function() {
				console.log('======000===========', this.scanwaybillId);
				let that = this;
				that.wxRequest({
					url: `${that.API}/miniApp/loadingOrder/scanCheck`,
					method: 'POST',
					data: {
						waybillId: that.scanwaybillId
					},
					success: res => {
						uni.setStorageSync(that.DATA_KEY.etpId, res.data.data.etpId);
						uni.setStorageSync(that.DATA_KEY.etpName, res.data.data.etpName);
						that.etpId = uni.getStorageSync(that.DATA_KEY.etpId);
						that.etpName = uni.getStorageSync(that.DATA_KEY.etpName);

						that.wxRequest({
							url: `${that.API}/miniApp/loadingOrder/getVehiclesByDriverId`,
							method: 'POST',
							title: '车辆信息查询中...',
							data: {
								driverId: uni.getStorageSync(that.DATA_KEY.userInfo).driverId,
								waybillId: that.scanwaybillId
							},
							success: res => {
								that.vehiclelist = res.data.data;
								that.platenNum = '';
								that.textArray = '';

								that.$refs.popup1.open('center');
								that.ishine = false;
								// uni.setStorageSync(that.DATA_KEY.userInfo, res.data.data.userModel);
								// that.userInfo = uni.getStorageSync(that.DATA_KEY.userInfo);
								// that.wxRequest({
								// 	url: `${that.API}/miniApp/vehicle/driverVehicleList`,
								// 	method: 'POST',
								// 	data: {
								// 		etpId: that.etpId
								// 	},
								// 	success: res => {
								// 		let data = res.data.data;
								// 		that.vehiclelist = [];
								// 		if (data.length > 0) {
								// 			for (var i = 0; i < data.length; i++) {
								// 				if (data[i].shippingStatus == 1) {
								// 					that.vehiclelist.push(data[i]);
								// 				}
								// 			}
								// 			if (that.vehiclelist.length > 0) {
								// 				console.log('ddddddddddd===', '有车空闲');
								// 				that.$refs.popup1.open('center');
								// 			} else {
								// 				uni.showModal({
								// 					title: '车辆繁忙',
								// 					content: '车辆正处于接单状态!',
								// 					showCancel: false,
								// 					success: function(res) {}
								// 				});
								// 			}
								// 		} else {
								// 			console.log('没车');
								// 			uni.showModal({
								// 				title: '选择车辆',
								// 				content: '您尚未关联可用车辆\n立即添加车辆',
								// 				showCancel: false,
								// 				success: function(res) {
								// 					let isDefault = 1;
								// 					if (data.length > 0) {
								// 						isDefault = 0;
								// 					}
								// 					uni.navigateTo({
								// 						url: `../personal/vehicleinformation?isDefault=` + isDefault + '&vehicleId=0'
								// 					});
								// 				}
								// 			});
								// 		}
								// 	}
								// });
							}
						});

						// that.wxRequest({
						// 	url:
						// 		`${that.API}/driverService/getDriverInfoByDriverID?driver_id=` +
						// 		uni.getStorageSync(that.DATA_KEY.userInfo).driverId +
						// 		'&etp_id=' +
						// 		uni.getStorageSync(that.DATA_KEY.etpId),
						// 	method: 'POST',
						// 	title: '加载中...',
						// 	success: res => {
						// 		uni.setStorageSync(that.DATA_KEY.userInfo, res.data.data.userModel);
						// 		that.userInfo = uni.getStorageSync(that.DATA_KEY.userInfo);
						// 		that.wxRequest({
						// 			url: `${that.API}/miniApp/vehicle/driverVehicleList`,
						// 			method: 'POST',
						// 			data: {
						// 				etpId: that.etpId
						// 			},
						// 			success: res => {
						// 				let data = res.data.data;
						// 				that.vehiclelist = [];
						// 				if (data.length > 0) {
						// 					for (var i = 0; i < data.length; i++) {
						// 						if (data[i].shippingStatus == 1) {
						// 							that.vehiclelist.push(data[i]);
						// 						}
						// 					}
						// 					if (that.vehiclelist.length > 0) {
						// 						console.log('ddddddddddd===', '有车空闲');
						// 						that.$refs.popup1.open('center');
						// 					} else {
						// 						uni.showModal({
						// 							title: '车辆繁忙',
						// 							content: '车辆正处于接单状态!',
						// 							showCancel: false,
						// 							success: function(res) {}
						// 						});
						// 					}
						// 				} else {
						// 					console.log('没车');
						// 					uni.showModal({
						// 						title: '选择车辆',
						// 						content: '您尚未关联可用车辆\n立即添加车辆',
						// 						showCancel: false,
						// 						success: function(res) {
						// 							let isDefault = 1;
						// 							if (data.length > 0) {
						// 								isDefault = 0;
						// 							}
						// 							uni.navigateTo({
						// 								url: `../personal/vehicleinformation?isDefault=` + isDefault + '&vehicleId=0'
						// 							});
						// 						}
						// 					});
						// 				}
						// 			}
						// 		});
						// 	}
						// });
					},
					complete: res => {
						that.isscan = false;
					}
				});
			},
			onReport: function(item) {
				this.navigateTo({
					url: '../personal/abnormalreported?data=' + JSON.stringify(item)
				});
			},
			onDetail: async function(item) {
				if (this.userInfo.status != 2) {
					uni.showToast({
						title: '请在司机信息审核通过后再进行操作！',
						icon: 'none'
					});
					return;
				}
				// #ifdef MP-WEIXIN
				this.onSubscribeMessage();
				// #endif

				// if (this.userInfo.isLocation == 0) {
				// 	uni.showToast({
				// 		title: '请进行基站定位授权后再进行操作！',
				// 		icon: 'none'
				// 	});
				// 	return;
				// }
				// if (this.userInfo.contractStatus != 3) {
				// 	uni.showToast({
				// 		title: '请进行签约后再进行操作！',
				// 		icon: 'none'
				// 	});
				// 	return;
				// }
				let that = this;
				// #ifdef MP-WEIXIN
				uni.getSystemInfo({
					success(res) {
						var isopendingwei = res.locationEnabled;
						if (isopendingwei == false) {
							uni.showModal({
								title: '提示',
								content: '请开启手机gps定位,设置-隐私-位置',
								showCancel: false,
								success: function(res) {}
							});
						} else {
							//获取位置后台定位授权
							uni.authorize({
								scope: 'scope.userLocationBackground',
								success(infoRes) {
									uni.getSetting({
										success(res) {
											if (!res.authSetting[
													'scope.userLocationBackground']) {
												uni.showModal({
													title: '"司机小程序"需要获取您的当前位置',
													content: '请点击设置->打开位置信息->使用小程序期间和离开小程序后',
													confirmText: '设置',
													showCancel: false,
													success(res) {
														if (res.confirm) {
															uni.openSetting({
																success(res) {}
															});
														}
													}
												});
											} else {
												// uni.startLocationUpdateBackground({
												// 	success: res => {
												// 		uni.onLocationChange(data => {
												// 			saveLocation({
												// 				lng: data.longitude,
												// 				lat: data.latitude
												// 			}).then(res => {
												// 				console.log('定1位：', res);
												// 			});
												// 		});
												// 	},
												// 	fail: res => {
												// 		console.log('获取位置失败', res);
												// 	}
												// });
												that.navigateTo({
													url: '../task/taskdetail?data=' +
														JSON.stringify(item)
												});
												// uni.navigateTo({
												// 	url: '../task/taskdetail?data=' + JSON.stringify(item)
												// });
											}
										}
									});
								},
								fail(res) {
									uni.showModal({
										title: '"司机小程序"需要获取您的当前位置',
										content: '请点击设置->打开位置信息->使用小程序期间和离开小程序后',
										confirmText: '设置',
										showCancel: false,
										success(res) {
											if (res.confirm) {
												uni.openSetting({
													success(res) {}
												});
											}
										}
									});
								}
							});
						}
					}
				});
				// #endif
				// #ifdef APP-PLUS
				var result;
				if (uni.getSystemInfoSync().platform == 'android') {
					result = await permision.requestAndroidPermission('android.permission.ACCESS_FINE_LOCATION');
				} else if (uni.getSystemInfoSync().platform == 'ios') {
					result = permision.judgeIosPermission("location") == true ? 1 :
					0; //判断iOS上是否给予位置权限，有权限返回true，否则返回false
				}
				if (permision.checkSystemEnableLocation() == false) {
					uni.showModal({
						title: '提示',
						content: '请开启手机gps定位,设置-隐私-位置',
						showCancel: false,
						success: function(res) {}
					});
					return;
				} else {
					if (result == 1) {
						that.navigateTo({
							url: '../task/taskdetail?data=' + JSON.stringify(item)
						});
						// uni.navigateTo({
						// 	url: '../task/taskdetail?data=' + JSON.stringify(item)
						// });
					} else {
						uni.showModal({
							title: '该程序需要获取您的当前位置',
							confirmText: '去授权',
							showCancel: false,
							success(res) {
								if (res.confirm) {
									permision.gotoAppPermissionSetting();
								}
							}
						});
					}
				}
				// #endif
			},
			//接单
			async onOrders(taskvalue) {
				// let isSignShow = await this.$refs.signPop.beforeShow(taskvalue)
				// if (isSignShow) {
				// 	this.signPopShow = true
				// 	return
				// }
				uni.setStorageSync(this.DATA_KEY.waybillId, taskvalue.waybillId);
				uni.setStorageSync(this.DATA_KEY.taskvalue, taskvalue);
				this.wxRequest({
					url: `${this.API}/driverService/checkQualifications`,
					method: 'POST',
					data: {
						driverId: uni.getStorageSync(this.DATA_KEY.userInfo).driverId,
						etpId: uni.getStorageSync(this.DATA_KEY.etpId),
						loadingOrderId: taskvalue.loadingOrderId
					},
					success: res => {
						this.isValidCont = res.data.data.isValidCont;
						uni.setStorageSync(this.DATA_KEY.platformCoNo, res.data.data.platformCoNo);
						// this.driverStatus = res.data.data.driverStatus
						// console.log(this.driverStatus)
						if (!res.data.data.flag) {
							console.log(this.realNameStext)
							console.log(this.realNameStext == '已实名' || this.realNameStext == '申诉中')
							if (this.realNameStext == '已实名') {
								if (taskvalue.vehicleFlag == 0) {
									uni.showModal({
										title: '车辆未注册',
										content: `当前配载单承运车辆${taskvalue.vehicleNo}，未注册，请注册车辆后接单`,
										confirmText: '注册车辆',
										confirmColor: '#49A9F0',
										success: function(res) {
											if (res.confirm) {
												console.log('用户点击确定');
												uni.navigateTo({
													url: `/pages/vehicle/vehiclelist`
												});
											} else if (res.cancel) {
												console.log('用户点击取消');
											}
										}
									});
								} else {

									// #ifdef MP-WEIXIN
									this.onSubscribeMessage();
									// #endif
									this.issign('', taskvalue.loadingOrderId, taskvalue.vehicleNo, 0);
								}
							} else {
								this.onrealverif(res);
							}
						} else {
							console.log('taskvalue.vehicleFlag',taskvalue.vehicleFlag,taskvalue);
							if (taskvalue.vehicleFlag == 0) {
								uni.showModal({
									title: '车辆未注册',
									content: `当前配载单承运车辆${taskvalue.vehicleNo}，未注册，请注册车辆后接单`,
									confirmText: '注册车辆',
									confirmColor: '#49A9F0',
									success: function(res) {
										if (res.confirm) {
											console.log('用户点击确定');
											uni.navigateTo({
												url: `/pages/vehicle/vehiclelist`
											});
										} else if (res.cancel) {
											console.log('用户点击取消');
										}
									}
								});
								return
							}
							//	司机检测黑名单
							let that = this
							this.wxRequest({
								url: `${this.API}/blacklist/queryBlacklist`,
								method: 'POST',
								data: {
									etpId: uni.getStorageSync(this.DATA_KEY.etpId),
									typeId: "1", //id类型 1司机 2车辆
									driverVehicleId: uni.getStorageSync(this.DATA_KEY.userInfo)
										.driverId
								},
								success: res => {
									console.log(res.data.data);
									if (res.data.data) {
										uni.showModal({
											title: '禁止接单',
											content: `您已被${uni.getStorageSync(that.DATA_KEY.etpName)}列为黑名单`,
											showCancel: false,
											confirmText: '确定',
											confirmColor: '#49A9F0',
											success: function(res) {

											}
										});
									} else {
										//	车辆检测黑名单
										this.wxRequest({
											url: `${this.API}/blacklist/queryBlacklist`,
											method: 'POST',
											data: {
												etpId: uni.getStorageSync(this.DATA_KEY
													.etpId),
												typeId: "2", //id类型 1司机 2车辆
												driverVehicleId: taskvalue.vehicleId
											},
											success: res => {
												console.log(res.data.data);
												if (res.data.data) {
													uni.showModal({
														title: '禁止接单',
														content: `车辆：${taskvalue.vehicleNo}已被${uni.getStorageSync(that.DATA_KEY.etpName)}列为黑名单，请更换其他车辆`,
														showCancel: false,
														confirmText: '确定',
														confirmColor: '#49A9F0',
														success: function(
														res) {

														}
													});
												} else {
													// #ifdef MP-WEIXIN
													this.onSubscribeMessage();
													// #endif
													this.issign('', taskvalue
														.loadingOrderId, taskvalue
														.vehicleNo, 0);
												}
											}
										});
									}
								}
							});
							// #ifdef MP-WEIXIN
							// this.onSubscribeMessage();
							// #endif
							// this.issign('', taskvalue.loadingOrderId, taskvalue.vehicleNo, 0);
						}
						this.getMessage()
					}
				});
				// console.log(taskvalue, '444444444444444')
				// if (this.userInfo.status != 2) {
				// 	uni.showToast({
				// 		title: '请添加司机信息并审核通过后再进行操作！',
				// 		icon: 'none'
				// 	});
				// 	return;
				// }
			},
			// 起运/到达
			async onAuthorize(taskvalue) {
				this.orderloadingOrderId = taskvalue.loadingOrderId;
				this.ordercheckinSeq = taskvalue.nextCheckinSeq;
				this.CheckinNodeName = taskvalue.nextCheckinNodeName
				this.nextCheckinWriteShippedNum = taskvalue.nextCheckinWriteShippedNum;
				this.nextCheckinWriteReceiptedNum = taskvalue.nextCheckinWriteReceiptedNum;
				this.nextCheckinUploadPicture = taskvalue.nextCheckinUploadPicture;
				// #ifdef MP-WEIXIN
				this.onSubscribeMessage();
				// #endif
				try{
					if (taskvalue.nextCheckinNodeName == '起运') {
						this.logFn(`点击起运`)
						let fenceData = await this.createCircleFenceIsSuccess(taskvalue)
						if (fenceData && fenceData.data.fenceStatus == 1) {
							let shippingStatus = await this.getShippingStatus(taskvalue)
							if (shippingStatus == 2) {
								this.page = 1;
								this.onwaybill(that.mescroll);
							} else {
								this.logFn(`fenceStatus=1`)
								uni.showModal({
									title: '提示',
									content: '未检测到您进入指定区域取货后出发，是否确认起运？',
									success: async e => {
										if (e.confirm) {
											this.logFn(`fenceStatus=1,开始获取位置`)
											gps.init()
											let result = await gps.startLoctionBackgroundUpdate(taskvalue, this.cronJsFance, this.checkinFun)
											// if (result) {
											// 	await this.checkinFun(taskvalue)
											// 	this.cronJsFance(taskvalue, result)
											// }
										}
									}
								})
							}
						} else {
							this.logFn(`fenceStatus!=1,开始获取位置`)
							gps.init()
							let result = await gps.startLoctionBackgroundUpdate(taskvalue, this.uploadMinilocus, this.checkinFun)
							// if (result) {
							// 	await this.checkinFun(taskvalue)
							// 	this.uploadMinilocus(taskvalue, result)
							// }
						}
					} else if (taskvalue.nextCheckinNodeName == '到达') {
						this.logFn(`点击到达`)
						let fenceData = await this.createCircleFenceIsSuccess(taskvalue)
						if (fenceData && fenceData.data.fenceStatus == 1) {
							let shippingStatus = await this.getShippingStatus(taskvalue)
							if (shippingStatus == 3) {
								this.page = 1;
								this.onwaybill(that.mescroll);
							} else {
								uni.showModal({
									title: '提示',
									content: '未检测到您进入指定区域送货，是否确认到达？',
									success: async e => {
										if (e.confirm) {
											this.logFn(`fenceStatus=1,开始获取位置`)
											let result = await gps.stopLocationUpdate(taskvalue, this.uploadMinilocus, this.checkinFun)
											if (result) {
												this.checkinFun(taskvalue)
											}
										}
									}
								})
							}
						} else {
							this.logFn(`fenceStatus!=1,开始获取位置`)
							let result = await gps.stopLocationUpdate(taskvalue, this.uploadMinilocus, this.checkinFun)
							if (result) {
								this.checkinFun(taskvalue)
							}
						}
					} else {
						this.checkinFun(taskvalue)
					}
				}catch(e){
					//TODO handle the exception
				}
				return 
				// if (this.userInfo.status != 2) {
				// 	uni.showToast({
				// 		title: '请在司机信息审核通过后再进行操作！',
				// 		icon: 'none'
				// 	});
				// 	return;
				// }
				// #ifdef MP-WEIXIN
				this.onSubscribeMessage();
				// #endif
				// if (this.userInfo.isLocation == 0) {
				// 	uni.showToast({
				// 		title: '请进行基站定位授权后再进行操作！',
				// 		icon: 'none'
				// 	});
				// 	return;
				// }
				// if (this.userInfo.contractStatus != 3) {
				// 	uni.showToast({
				// 		title: '请进行签约后再进行操作！',
				// 		icon: 'none'
				// 	});
				// 	return;
				// }
				let that = this;
				let islocation = false;
				// #ifdef MP-WEIXIN
				//异步获取系统信息
				uni.getSystemInfo({
					success(res) {
						var isopendingwei = res.locationEnabled; //locationEnabled 地理位置的开关（微信小程序）
						if (!res.locationEnabled) {
							uni.showModal({
								title: '提示',
								content: '请开启手机gps定位,设置-隐私-位置',
								showCancel: false,
								success: function(res) {}
							});
						} else {
							//获取位置后台定位授权
							uni.authorize({
								scope: 'scope.userLocationBackground', //后台定位 （微信小程序）
								success(infoRes) {
									//获取用户的当前设置（不支持H5、App）
									uni.getSetting({
										success(res) {
											that.$forceUpdate();
											if (!res.authSetting[
													'scope.userLocationBackground']) {
												uni.showModal({
													title: '"司机小程序"需要获取您的当前位置',
													content: '请点击设置->打开位置信息->使用小程序期间和离开小程序后',
													confirmText: '设置',
													showCancel: false,
													success(res) {
														if (res.confirm) {
															uni.openSetting({
																success(res) {}
															});
														}
													}
												});
											} else {
												islocation = true;
												that.orderloadingOrderId = taskvalue
													.loadingOrderId;
												that.ordercheckinSeq = taskvalue
												.nextCheckinSeq;
												that.CheckinNodeName = taskvalue
													.nextCheckinNodeName
												that.nextCheckinWriteShippedNum = taskvalue
													.nextCheckinWriteShippedNum;
												that.nextCheckinWriteReceiptedNum = taskvalue
													.nextCheckinWriteReceiptedNum;
												that.nextCheckinUploadPicture = taskvalue
													.nextCheckinUploadPicture;
												// that.locationLog({
												// 	content: '点击开始' + taskvalue.nextCheckinNodeName
												// })
												if (taskvalue.nextCheckinNodeName == '起运') {
													uni.setStorageSync('taskLoading', 'start')
													//启动定位
													// #ifdef MP-WEIXIN
													console.log(taskvalue)
													// that.locationLog({
													// 	loadingOrderId: taskvalue.loadingOrderId,
													// 	content: '起运开始调用接口createCircleFenceIsSuccess' 
													// })
													that.wxRequest({
														url: `${that.API}/fance/waybillFence/createCircleFenceIsSuccess?waybillId=${taskvalue.waybillId}`,
														method: 'get',
														title: '加载中...',
														success: async res => {
															console.log(res.data)
															if (res.data.data &&
																res.data.data
																.fenceStatus == 1
																) {
																// that.locationLog({
																// 	content: '起运开始调用接口getShippingStatus，fenceStatus：1' 
																// })
																that.wxRequest({
																	url: `${that.API}/fance/waybillFence/getShippingStatus?id=${taskvalue.loadingOrderId}`,
																	method: 'get',
																	title: '加载中...',
																	success: re => {
																		if (re
																			.data
																			.data
																			.shippingStatus ==
																			2
																			) {
																			that.page =
																				1;
																			that.onwaybill(
																				that
																				.mescroll
																				);
																		} else {
																			uni.showModal({
																				title: '提示',
																				content: '未检测到您进入指定区域取货后出发，是否确认起运？',
																				success: async res1 => {
																					if (res1
																						.confirm
																						) {
																						that.locationLog({
																							content: '起运未检测到您进入指定区域取货后出发，确认起运，位置监听准备开启' 
																						})
																						uni.setStorageSync(
																							'__isExitFlag__',
																							true
																							);
																						uni.setStorageSync(
																							that
																							.DATA_KEY
																							.loadingOrderId,
																							taskvalue
																							.loadingOrderId
																							);
																						let
																					Trajectory = [];
																						//从本地缓存中同步获取指定key对应的内容
																						uni.setStorageSync(
																							'Trajectory',
																							Trajectory
																							);
																							await that.stopLocationUpdate()
																						//uni.startLocationUpdateBackground开始监听实时地理位置信息变化事件，小程序进入前后台时均接收实时地理位置信息
																						wx.startLocationUpdateBackground({
																							success: res => {
																								console
																									.log(
																										res
																										)
																								that.locationLog({
																									content: '起运位置监听开启成功' 
																								})
																								//uni.onLocationChange 监听实时地理位置变化事件
																								wx.onLocationChange(
																									async data => {
																										// that.locationLog({
																										// 	content: '起运位置获取失败成功，准备调用cronJsFance'+ JSON.stringify(data) 
																										// })
																										var currentTime =
																											new Date()
																											.getTime();
																										var oldTime =
																											uni
																											.getStorageSync(
																												that
																												.DATA_KEY
																												.timeOld
																												);
																										console
																											.log(
																												currentTime,
																												oldTime,
																												currentTime -
																												oldTime >
																												180000
																												);
																										if (currentTime -
																											oldTime >
																											180000
																											) {
																											console.log(data , '当前开始地点')
																											if (!(Object.prototype.toString.call(data) === '[object Object]' && data.latitude && data.longitude)) {
																												let loc = await that.LunLocation()
																												data = loc
																											}
																											console.log(data , '当前结束地点')
																											uni.setStorageSync(
																												that
																												.DATA_KEY
																												.timeOld,
																												currentTime
																												);
																											that.wxRequest({
																												url: `${that.API}/fance/waybillFence/cronJsFance`,
																												method: 'POST',
																												data: {
																													vehicleNo: taskvalue
																														.vehicleNo, //车牌号
																													driverTel: uni
																														.getStorageSync(
																															that
																															.DATA_KEY
																															.userInfo
																															)
																														.mobile, //手机号
																													trackType: 2,
																													driverId: uni
																														.getStorageSync(
																															that
																															.DATA_KEY
																															.userInfo
																															)
																														.driverId,
																													loadingOrderId: uni
																														.getStorageSync(
																															that
																															.DATA_KEY
																															.loadingOrderId
																															),
																													lat: data
																														.latitude,
																													lng: data
																														.longitude
																												},
																												success: res => {
																													// that.locationLog({
																													// 	content: '起运调用uploadMinilocus成功'+ JSON.stringify(res.data) 
																													// })
																													console
																														.log(
																															res
																															)
																												},
																												complete: res => {
																													if (uni.getStorageSync('taskLoading') == 'start') {
																														that.locationLog({
																															content: '已调用cronJsFance'+ JSON.stringify(res) 
																														})
																														uni.setStorageSync('taskLoading', 'loading')
																													}
																												}
																											});

																											let
																										Trajectory = [];
																											console
																												.log(
																													'轨迹点0   ',
																													uni
																													.getStorageSync(
																														'Trajectory'
																														)
																													);
																											console
																												.log(
																													'轨迹点1   ',
																													!
																													uni
																													.getStorageSync(
																														'Trajectory'
																														)
																													);
																											if (uni
																												.getStorageSync(
																													'Trajectory'
																													)
																												.length ==
																												0
																												) {
																												Trajectory
																													= [];
																											} else {
																												Trajectory
																													=
																													uni
																													.getStorageSync(
																														'Trajectory'
																														);
																											}
																											console
																												.log(
																													'运单号0   ',
																													uni
																													.getStorageSync(
																														that
																														.DATA_KEY
																														.loadingOrderId
																														) !=
																													''
																													);
																											let Trajectoryinfo = {
																												lat: data
																													.latitude,
																												lng: data
																													.longitude,
																												positionTime: currentTime
																											};
																											Trajectory
																												.push(
																													Trajectoryinfo
																													);
																											uni.setStorageSync(
																												'Trajectory',
																												Trajectory
																												);
																											console
																												.log(
																													'轨迹数据 ',
																													uni
																													.getStorageSync(
																														'Trajectory'
																														)
																													);
																											/* that.wxRequest({
																												url: `${that.API}/driverService/uploadMinilocus`,
																												method: 'POST',
																												data: {
																													trackType: 2,
																													loadingOrderId: uni.getStorageSync(that.DATA_KEY.loadingOrderId),
																													list: Trajectory,
																													vehicleNo: taskvalue.vehicleNo,
																													driverTel: uni.getStorageSync(that.DATA_KEY.userInfo).mobile
																												},
																												success: res => {
																													Trajectory = [];
																													uni.setStorageSync('Trajectory', Trajectory);
																												}
																											}); */
																										}
																									}
																									);
																							},
																							fail: async res => {
																								that.locationLog({
																									content: '起运位置监听开启失败'+ JSON.stringify(res) 
																								})
																								let loc = await that.LunLocation()
																								if (loc) {
																									that.wxRequest({
																										url: `${that.API}/fance/waybillFence/cronJsFance`,
																										method: 'POST',
																										data: {
																											vehicleNo: taskvalue
																												.vehicleNo, //车牌号
																											driverTel: uni
																												.getStorageSync(
																													that
																													.DATA_KEY
																													.userInfo
																													)
																												.mobile, //手机号
																											trackType: 2,
																											driverId: uni
																												.getStorageSync(
																													that
																													.DATA_KEY
																													.userInfo
																													)
																												.driverId,
																											loadingOrderId: uni
																												.getStorageSync(
																													that
																													.DATA_KEY
																													.loadingOrderId
																													),
																											lat: loc
																												.latitude,
																											lng: loc
																												.longitude
																										},
																										success: res => {
																											// that.locationLog({
																											// 	content: '起运调用uploadMinilocus成功'+ JSON.stringify(res.data) 
																											// })
																											console
																												.log(
																													res
																													)
																										},
																										complete: res => {
																											if (uni.getStorageSync('taskLoading') == 'start') {
																												that.locationLog({
																													content: '已调用cronJsFance'+ JSON.stringify(res) 
																												})
																												uni.setStorageSync('taskLoading', 'loading')
																											}
																										}
																									});
																								}
																								console
																									.log(
																										'获取位置失败',
																										res
																										);
																							}
																						});
																						that.checkinFun(
																							taskvalue
																							)
																					} else if (
																						res1
																						.cancel
																						) {
																						console
																							.log(
																								'用户点击取消'
																								);
																					}
																				}
																			});
																		}
																	}
																})
															} else {
																uni.setStorageSync(
																	'__isExitFlag__',
																	true);
																that.locationLog({
																	content: '起运fenceStatus不为1，准备开启位置监听'
																})
																uni.setStorageSync(
																	that
																	.DATA_KEY
																	.loadingOrderId,
																	taskvalue
																	.loadingOrderId
																	);
																let
															Trajectory = [];
																uni.setStorageSync(
																	'Trajectory',
																	Trajectory);
																	await that.stopLocationUpdate()
																// uni.startLocationUpdateBackground 位置更新
																wx.startLocationUpdateBackground({
																	success: res => {
																		//uni.onLocationChange  使用应用内置地图查看位置
																		that.locationLog({
																			content: '起运位置监听开启成功'
																		})
																		wx.onLocationChange(
																			async data => {
																				var currentTime =
																					new Date()
																					.getTime();
																				var oldTime =
																					uni
																					.getStorageSync(
																						that
																						.DATA_KEY
																						.oldTime
																						);
																				console
																					.log(
																						'起运  时间 -----',
																						currentTime,
																						oldTime,
																						currentTime -
																						oldTime >
																						180000
																						);
																				if (currentTime -
																					oldTime >
																					180000
																					) {
																					console.log(data , '当前开始地点')
																					if (!(Object.prototype.toString.call(data) === '[object Object]' && data.latitude && data.longitude)) {
																						let loc = await that.LunLocation()
																						data = loc
																					}
																					console.log(data , '当前结束地点')
																					uni.setStorageSync(
																						that
																						.DATA_KEY
																						.oldTime,
																						currentTime
																						);
																					let
																				Trajectory = [];
																					console
																						.log(
																							'轨迹点0   ',
																							uni
																							.getStorageSync(
																								'Trajectory'
																								)
																							);
																					console
																						.log(
																							'轨迹点1   ',
																							!
																							uni
																							.getStorageSync(
																								'Trajectory'
																								)
																							);
																					if (uni
																						.getStorageSync(
																							'Trajectory'
																							)
																						.length ==
																						0
																						) {
																						Trajectory
																							= [];
																					} else {
																						Trajectory
																							=
																							uni
																							.getStorageSync(
																								'Trajectory'
																								);
																					}
																					console
																						.log(
																							'运单号0   ',
																							uni
																							.getStorageSync(
																								that
																								.DATA_KEY
																								.loadingOrderId
																								) !=
																							''
																							);
																					let Trajectoryinfo = {
																						lat: data
																							.latitude,
																						lng: data
																							.longitude,
																						positionTime: currentTime
																					};
																					Trajectory
																						.push(
																							Trajectoryinfo
																							);
																					uni.setStorageSync(
																						'Trajectory',
																						Trajectory
																						);
																					console
																						.log(
																							'轨迹数据 ',
																							uni
																							.getStorageSync(
																								'Trajectory'
																								)
																							);
																					// that.locationLog({
																					// 	content: '起运位置获取失败成功，准备调用uploadMinilocus'+ JSON.stringify(data) 
																					// })
																					that.wxRequest({
																						url: `${that.API}/driverService/uploadMinilocus`,
																						method: 'POST',
																						data: {
																							trackType: 2,
																							loadingOrderId: uni
																								.getStorageSync(
																									that
																									.DATA_KEY
																									.loadingOrderId
																									),
																							list: Trajectory,
																							vehicleNo: taskvalue
																								.vehicleNo,
																							driverTel: uni
																								.getStorageSync(
																									that
																									.DATA_KEY
																									.userInfo
																									)
																								.mobile
																						},
																						success: res => {
																							Trajectory
																								= [];
																							// that.locationLog({
																							// 	content: '起运调用uploadMinilocus成功'+ JSON.stringify(res.data) 
																							// })
																							uni.setStorageSync(
																								'Trajectory',
																								Trajectory
																								);
																						},
																						complete: res => {
																							if (uni.getStorageSync('taskLoading') == 'start') {
																								that.locationLog({
																									content: '已调用uploadMinilocus'+ JSON.stringify(res) 
																								})
																								uni.setStorageSync('taskLoading', 'loading')
																							}
																						}
																					});
																				}
																			}
																			);
																	},
																	fail: async res => {
																		that.locationLog({
																			content: '起运位置监听开启失败' + JSON.stringify(res)
																		})
																		let loc = await that.LunLocation()
																		if (loc) {
																			let currentTime =
																				new Date()
																				.getTime();
																			let Trajectory = []
																			let Trajectoryinfo = {
																				lat: loc
																					.latitude,
																				lng: loc
																					.longitude,
																				positionTime: currentTime
																			};
																			Trajectory
																				.push(
																					Trajectoryinfo
																					);
																			that.wxRequest({
																				url: `${that.API}/driverService/uploadMinilocus`,
																				method: 'POST',
																				data: {
																					trackType: 2,
																					loadingOrderId: uni
																						.getStorageSync(
																							that
																							.DATA_KEY
																							.loadingOrderId
																							),
																					list: Trajectory,
																					vehicleNo: taskvalue
																						.vehicleNo,
																					driverTel: uni
																						.getStorageSync(
																							that
																							.DATA_KEY
																							.userInfo
																							)
																						.mobile
																				},
																				success: res => {
																					Trajectory
																						= [];
																					// that.locationLog({
																					// 	content: '起运调用uploadMinilocus成功'+ JSON.stringify(res.data) 
																					// })
																					uni.setStorageSync(
																						'Trajectory',
																						Trajectory
																						);
																				},
																				complete: res => {
																					if (uni.getStorageSync('taskLoading') == 'start') {
																						that.locationLog({
																							content: '已调用uploadMinilocus'+ JSON.stringify(res) 
																						})
																						uni.setStorageSync('taskLoading', 'loading')
																					}
																				}
																			});
																		}
																		
																		console
																			.log(
																				'获取位置失败',
																				res
																				);
																	}
																});
																that.checkinFun(
																	taskvalue)
															}
														}
													});
													//启动定位
													/* uni.setStorageSync('__isExitFlag__', true);
													uni.setStorageSync(that.DATA_KEY.loadingOrderId, taskvalue.loadingOrderId);
													let Trajectory = [];
													uni.setStorageSync('Trajectory', Trajectory);
													wx.startLocationUpdateBackground({
														success: res => {
															wx.onLocationChange(data => {
																var currentTime = new Date().getTime();
																var oldTime = uni.getStorageSync(that.DATA_KEY.oldTime);
																console.log('起运  时间 ', currentTime, oldTime, currentTime - oldTime > 180000);
																if (currentTime - oldTime > 180000) {
																	uni.setStorageSync(that.DATA_KEY.oldTime, currentTime);
																	let Trajectory = [];
																	console.log('轨迹点0   ', uni.getStorageSync('Trajectory'));
																	console.log('轨迹点1   ', !uni.getStorageSync('Trajectory'));
																	if (uni.getStorageSync('Trajectory').length == 0) {
																		Trajectory = [];
																	} else {
																		Trajectory = uni.getStorageSync('Trajectory');
																	}
																	console.log('运单号0   ', uni.getStorageSync(that.DATA_KEY.loadingOrderId) != '');
																	let Trajectoryinfo = {
																		lat: data.latitude,
																		lng: data.longitude,
																		positionTime: currentTime
																	};
																	Trajectory.push(Trajectoryinfo);
																	uni.setStorageSync('Trajectory', Trajectory);
																	console.log('轨迹数据 ', uni.getStorageSync('Trajectory'));
																	that.wxRequest({
																		url: `${that.API}/driverService/uploadMinilocus`,
																		method: 'POST',
																		data: {
																			trackType: 2,
																			loadingOrderId: uni.getStorageSync(that.DATA_KEY.loadingOrderId),
																			list: Trajectory,
																			vehicleNo: taskvalue.vehicleNo,
																			driverTel: uni.getStorageSync(that.DATA_KEY.userInfo).mobile
																		},
																		success: res => {
																			Trajectory = [];
																			uni.setStorageSync('Trajectory', Trajectory);
																		}
																	});
																}
															});
														},
														fail: res => {
															console.log('获取位置失败', res);
														}
													}); */
													// #endif

												} else if (taskvalue.nextCheckinNodeName ==
													'到达') {
													uni.setStorageSync('taskLoading', 'end')
													//结束定位
													// #ifdef MP-WEIXIN
													// that.locationLog({
													// 	content: '到达开始调用接口createCircleFenceIsSuccess' 
													// })
													that.wxRequest({
														url: `${that.API}/fance/waybillFence/createCircleFenceIsSuccess?waybillId=${taskvalue.waybillId}`,
														method: 'get',
														title: '加载中...',
														success: res => {
															console.log(res.data)
															if (res.data.data &&
																res.data.data
																.fenceStatus == 1
																) {
																	// that.locationLog({
																	// 	content: '到达开始调用接口getShippingStatus，fenceStatus：1' 
																	// })
																that.wxRequest({
																	url: `${that.API}/fance/waybillFence/getShippingStatus?id=${taskvalue.loadingOrderId}`,
																	method: 'get',
																	title: '加载中...',
																	success: re => {
																		if (re
																			.data
																			.data
																			.shippingStatus ==
																			3
																			) {
																			that.page =
																				1;
																			that.onwaybill(
																				that
																				.mescroll
																				);
																		} else {
																			uni.showModal({
																				title: '提示',
																				content: '未检测到您进入指定区域送货，是否确认到达？',
																				success: res1 => {
																					if (res1
																						.confirm
																						) {
																							// that.locationLog({
																							// 	content: '到达未检测到您进入指定区域取货后出发，确认到达，getLocation' 
																							// })
																						uni.setStorageSync(
																							'__isExitFlag__',
																							false
																							);
																						//获取当前位置的地理位置、速度
																						uni.getLocation({
																							type: 'wgs84',
																							success: async (
																								res
																								) => {
																									// that.locationLog({
																									// 	content: '到达getLocation成功，准备调用uploadMinilocus' + JSON.stringify(res) 
																									// })
																									console.log(res , '当前开始地点')
																									if (!(Object.prototype.toString.call(res) === '[object Object]' && res.latitude && res.longitude)) {
																										let loc = await that.LunLocation()
																										res = loc
																									}
																									console.log(res , '当前结束地点')
																								let currentTime =
																									new Date()
																									.getTime();
																								let Trajectory = []
																								let Trajectoryinfo = {
																									lat: res
																										.latitude, //纬度，浮点数，范围为-90~90，负数表示为南纬
																									lng: res
																										.longitude, //经度 浮点数 范围为-180~180 负数表示西经
																									positionTime: currentTime
																								};
																								Trajectory
																									.push(
																										Trajectoryinfo
																										);
																								uni.setStorageSync(
																									'Trajectory',
																									Trajectory
																									);
																								console
																									.log(
																										Trajectory
																										)
																								that.wxRequest({
																									url: `${that.API}/driverService/uploadMinilocus`,
																									method: 'POST',
																									data: {
																										trackType: 2,
																										loadingOrderId: uni
																											.getStorageSync(
																												that
																												.DATA_KEY
																												.loadingOrderId
																												),
																										list: Trajectory,
																										vehicleNo: taskvalue
																											.vehicleNo,
																										driverTel: uni
																											.getStorageSync(
																												that
																												.DATA_KEY
																												.userInfo
																												)
																											.mobile
																									},
																									success: res => {
																										// that.locationLog({
																										// 	content: '到达uploadMinilocus成功，' + JSON.stringify(res.data) 
																										// })
																										console
																											.log(
																												res
																												.data,
																												'关闭位置成功====传值成功'
																												)
																										Trajectory
																											= [];
																										uni.setStorageSync(
																											'Trajectory',
																											Trajectory
																											);
																									},
																									complete: res => {
																										if (uni.getStorageSync('taskLoading') == 'end') {
																											that.locationLog({
																												content: '已调用uploadMinilocus'+ JSON.stringify(res) 
																											})
																											uni.removeStorageSync('taskLoading')
																										}
																									}
																								});
																							},
																							fail: async res => {
																								that.locationLog({
																									content: '到达getLocation失败，' + JSON.stringify(res) 
																								})
																								let loc = await that.LunLocation()
																								if (loc) {
																									let currentTime =
																										new Date()
																										.getTime();
																									let Trajectory = []
																									let Trajectoryinfo = {
																										lat: loc
																											.latitude, //纬度，浮点数，范围为-90~90，负数表示为南纬
																										lng: loc
																											.longitude, //经度 浮点数 范围为-180~180 负数表示西经
																										positionTime: currentTime
																									};
																									Trajectory
																										.push(
																											Trajectoryinfo
																											);
																									uni.setStorageSync(
																										'Trajectory',
																										Trajectory
																										);
																									console
																										.log(
																											Trajectory
																											)
																									that.wxRequest({
																										url: `${that.API}/driverService/uploadMinilocus`,
																										method: 'POST',
																										data: {
																											trackType: 2,
																											loadingOrderId: uni
																												.getStorageSync(
																													that
																													.DATA_KEY
																													.loadingOrderId
																													),
																											list: Trajectory,
																											vehicleNo: taskvalue
																												.vehicleNo,
																											driverTel: uni
																												.getStorageSync(
																													that
																													.DATA_KEY
																													.userInfo
																													)
																												.mobile
																										},
																										success: res => {
																											// that.locationLog({
																											// 	content: '到达uploadMinilocus成功，' + JSON.stringify(res.data) 
																											// })
																											console
																												.log(
																													res
																													.data,
																													'关闭位置成功====传值成功'
																													)
																											Trajectory
																												= [];
																											uni.setStorageSync(
																												'Trajectory',
																												Trajectory
																												);
																										},
																										complete: res => {
																											if (uni.getStorageSync('taskLoading') == 'end') {
																												that.locationLog({
																													content: '已调用uploadMinilocus'+ JSON.stringify(res) 
																												})
																												uni.removeStorageSync('taskLoading')
																											}
																										}
																									});
																								}
																								console
																									.log(
																										'位置失败',
																										res
																										);
																							}
																						})
																						wx.stopLocationUpdate({
																							success: res => {
																								console
																									.log(
																										'关闭位置成功',
																										res
																										);
																							},
																							fail: res => {
																								console
																									.log(
																										'关闭位置失败',
																										res
																										);
																							}
																						});
																						uni.setStorageSync(that.DATA_KEY.oldTime, '')
																						that.checkinFun(
																							taskvalue
																							)
																					} else if (
																						res1
																						.cancel
																						) {
																						console
																							.log(
																								'用户点击取消'
																								);
																					}
																				}
																			});
																		}
																	}
																})
															} else {
																uni.setStorageSync(
																	'__isExitFlag__',
																	false);
																// that.locationLog({
																// 	content: '到达fenceStatus不为1，准备调用getLocation'
																// })
																uni.getLocation({
																	type: 'wgs84',
																	success: async (
																		res
																		) => {
																			// that.locationLog({
																			// 	content: '到达getLocation成功' + JSON.stringify(res)
																			// })
																			console.log(res , '当前开始地点')
																			if (!(Object.prototype.toString.call(res) === '[object Object]' && res.latitude && res.longitude)) {
																				let loc = await that.LunLocation()
																				res = loc
																			}
																			console.log(res , '当前结束地点')
																		let currentTime =
																			new Date()
																			.getTime();
																		let Trajectory = []
																		let Trajectoryinfo = {
																			lat: res
																				.latitude,
																			lng: res
																				.longitude,
																			positionTime: currentTime
																		};
																		Trajectory
																			.push(
																				Trajectoryinfo
																				);
																		uni.setStorageSync(
																			'Trajectory',
																			Trajectory
																			);
																		console
																			.log(
																				Trajectory
																				)
																		that.wxRequest({
																			url: `${that.API}/driverService/uploadMinilocus`,
																			method: 'POST',
																			data: {
																				trackType: 2,
																				loadingOrderId: uni
																					.getStorageSync(
																						that
																						.DATA_KEY
																						.loadingOrderId
																						),
																				list: Trajectory,
																				vehicleNo: taskvalue
																					.vehicleNo,
																				driverTel: uni
																					.getStorageSync(
																						that
																						.DATA_KEY
																						.userInfo
																						)
																					.mobile
																			},
																			success: res => {
																				// that.locationLog({
																				// 	content: '到达uploadMinilocus成功，' + JSON.stringify(res.data) 
																				// })
																				console
																					.log(
																						res
																						.data,
																						'关闭位置成功====传值成功'
																						)
																				Trajectory
																					= [];
																				uni.setStorageSync(
																					'Trajectory',
																					Trajectory
																					);
																			},
																			complete: res => {
																				if (uni.getStorageSync('taskLoading') == 'end') {
																					that.locationLog({
																						content: '已调用uploadMinilocus'+ JSON.stringify(res) 
																					})
																					uni.removeStorageSync('taskLoading')
																				}
																			}
																		});
																	},
																	fail: async res => {
																		that.locationLog({
																			content: '到达getLocation失败' + JSON.stringify(res)
																		})
																		let loc = await that.LunLocation()
																		if (loc) {
																			let currentTime =
																				new Date()
																				.getTime();
																			let Trajectory = []
																			let Trajectoryinfo = {
																				lat: loc
																					.latitude,
																				lng: loc
																					.longitude,
																				positionTime: currentTime
																			};
																			Trajectory
																				.push(
																					Trajectoryinfo
																					);
																			uni.setStorageSync(
																				'Trajectory',
																				Trajectory
																				);
																			console
																				.log(
																					Trajectory
																					)
																			that.wxRequest({
																				url: `${that.API}/driverService/uploadMinilocus`,
																				method: 'POST',
																				data: {
																					trackType: 2,
																					loadingOrderId: uni
																						.getStorageSync(
																							that
																							.DATA_KEY
																							.loadingOrderId
																							),
																					list: Trajectory,
																					vehicleNo: taskvalue
																						.vehicleNo,
																					driverTel: uni
																						.getStorageSync(
																							that
																							.DATA_KEY
																							.userInfo
																							)
																						.mobile
																				},
																				success: res => {
																					// that.locationLog({
																					// 	content: '到达uploadMinilocus成功，' + JSON.stringify(res.data) 
																					// })
																					console
																						.log(
																							res
																							.data,
																							'关闭位置成功====传值成功'
																							)
																					Trajectory
																						= [];
																					uni.setStorageSync(
																						'Trajectory',
																						Trajectory
																						);
																				},
																				complete: res => {
																					if (uni.getStorageSync('taskLoading') == 'end') {
																						that.locationLog({
																							content: '已调用uploadMinilocus'+ JSON.stringify(res) 
																						})
																						uni.removeStorageSync('taskLoading')
																					}
																				}
																			});
																		}
																		console
																			.log(
																				'位置失败',
																				res
																				);
																	}
																})
																wx.stopLocationUpdate({
																	success: res => {
																		console
																			.log(
																				'关闭位置成功',
																				res
																				);
																	},
																	fail: res => {
																		console
																			.log(
																				'关闭位置失败',
																				res
																				);
																	}
																});
																uni.setStorageSync(that.DATA_KEY.oldTime, '')
																that.checkinFun(
																	taskvalue)
															}
														}
													});
													/* uni.setStorageSync('__isExitFlag__', false);
													uni.getLocation({
														success: (res) => {
															let currentTime = new Date().getTime();
															let Trajectory = []
															let Trajectoryinfo = {
																lat: res.latitude,
																lng: res.longitude,
																positionTime: currentTime
															};
															Trajectory.push(Trajectoryinfo);
															uni.setStorageSync('Trajectory', Trajectory);
															console.log(Trajectory)
															that.wxRequest({
																url: `${that.API}/driverService/uploadMinilocus`,
																method: 'POST',
																data: {
																	trackType: 2,
																	loadingOrderId: uni.getStorageSync(that.DATA_KEY.loadingOrderId),
																	list: Trajectory,
																	vehicleNo: taskvalue.vehicleNo,
																	driverTel: uni.getStorageSync(that.DATA_KEY.userInfo).mobile
																},
																success: res => {
																	console.log(res.data, '关闭位置成功====传值成功')
																	Trajectory = [];
																	uni.setStorageSync('Trajectory', Trajectory);
																}
															});
														},
														fail: res => {
															console.log('位置失败', res);
														}
													})
													wx.stopLocationUpdate({
														success: res => {
															console.log('关闭位置成功', res);
														},
														fail: res => {
															console.log('关闭位置失败', res);
														}
													}); */
													// #endif
												} else {
													that.checkinFun(taskvalue)
												}
											}
										}
									});
								},
								fail(res) {
									uni.showModal({
										title: '"司机小程序"需要获取您的当前位置',
										content: '请点击设置->打开位置信息->使用小程序期间和离开小程序后',
										confirmText: '设置',
										showCancel: false,
										success(res) {
											if (res.confirm) {
												uni.openSetting({
													success(res) {}
												});
											}
										}
									});
								}
							});
						}
					}
				});
				// #endif
				// #ifdef APP-PLUS
				clearInterval(that.Interval01);
				var result;
				if (uni.getSystemInfoSync().platform == 'android') {
					//await permision.requestAndroidPermission  Android设备上当前App是否有某个权限
					//android.permission.ACCESS_FINE_LOCATION  位置权限
					result = await permision.requestAndroidPermission('android.permission.ACCESS_FINE_LOCATION');
					if (permision.checkSystemEnableLocation() == false) {
						uni.showModal({
							title: '提示',
							content: '请开启手机gps定位,设置-隐私-位置',
							showCancel: false,
							success: function(res) {}
						});
						return;
					} else {
						if (result == 1) {
							that.$forceUpdate();
							islocation = true;
							that.orderloadingOrderId = taskvalue.loadingOrderId;
							that.ordercheckinSeq = taskvalue.nextCheckinSeq;
							that.CheckinNodeName = taskvalue.nextCheckinNodeName
							that.nextCheckinWriteShippedNum = taskvalue.nextCheckinWriteShippedNum;
							that.nextCheckinWriteReceiptedNum = taskvalue.nextCheckinWriteReceiptedNum;
							that.nextCheckinUploadPicture = taskvalue.nextCheckinUploadPicture;
							if (taskvalue.nextCheckinNodeName == '起运') {
								//启动定位
								that.wxRequest({
									url: `${that.API}/fance/waybillFence/createCircleFenceIsSuccess?waybillId=${taskvalue.waybillId}`,
									method: 'get',
									title: '加载中...',
									success: res => {
										if (res.data.data && res.data.data.fenceStatus == 1) {
											that.wxRequest({
												url: `${that.API}/fance/waybillFence/getShippingStatus?id=${taskvalue.loadingOrderId}`,
												method: 'get',
												title: '加载中...',
												success: re => {
													if (re.data.data.shippingStatus == 2) {
														that.page = 1;
														that.onwaybill(that.mescroll);
													} else {
														uni.showModal({
															title: '提示',
															content: '未检测到您进入指定区域取货后出发，是否确认起运？',
															success: res1 => {
																if (res1.confirm) {
																	that.guijiUpload1(taskvalue, 1)
																	//上传坐标点
																	locationModule
																		.start({
																				appSecurity: taskvalue
																					.appSecurity,
																				enterpriseSenderCode: taskvalue
																					.enterpriseSenderCode,
																				ShippingNoteNumber: taskvalue
																					.loadingOrderId,
																				StartCountrySubdivisionCode: taskvalue
																					.shippingRegionCode,
																				EndCountrySubdivisionCode: taskvalue
																					.receiptRegionCode,
																				StartLongitude: taskvalue
																					.StartLongitude,
																				StartLatitude: taskvalue
																					.StartLatitude,
																				EndLongitude: taskvalue
																					.EndLongitude,
																				EndLatitude: taskvalue
																					.EndLatitude,
																				StartLocationText: taskvalue
																					.shippingCity,
																				EndLocationText: taskvalue
																					.receiptCity,
																				VehicleNumber: taskvalue
																					.vehicleNo,
																				DriverName: taskvalue
																					.driverName
																			},
																			ret => {
																				let rets =
																					ret
																					.code;
																				uni.getLocation({
																					type: 'wgs84',
																					success: function(
																						res
																						) {
																						let longitude =
																							res
																							.longitude;
																						let latitude =
																							res
																							.latitude;
																						if (rets ==
																							'发送定位send成功'
																							) {
																							uni.setStorageSync(
																								'loadingOrderId',
																								taskvalue
																								.loadingOrderId
																								);
																							//发送定位回调
																							uni.request({
																								url: `https://sign.y2t.com/tax/taxInfoUpload`,
																								method: 'POST',
																								data: {
																									vehicleNumber: taskvalue
																										.vehicleNo,
																									driverName: taskvalue
																										.driverName,
																									shippingNoteNumber: taskvalue
																										.loadingOrderId,
																									longitude: longitude,
																									latitude: latitude,
																									status: 1
																								},
																								success: res => {
																									uni
																								.hideLoading();
																									console
																										.log(
																											'发送定位回调结果',
																											res
																											);
																								},
																								fail: error => {
																									uni
																								.hideLoading();
																									uni.showToast({
																										title: '网络异常！',
																										icon: 'none'
																									});
																								},
																								complete: res => {
																									if (obj
																										.complete
																										)
																										obj
																										.complete(
																											res
																											);
																								}
																							});
																							console
																								.log(
																									'====================================',
																									taskvalue
																									.loadingOrderId
																									);
																						}
																						//上传坐标点
																						let currentTime =
																							new Date()
																							.getTime();
																						let Trajectory = []
																						let Trajectoryinfo = {
																							lat: latitude,
																							lng: longitude,
																							positionTime: currentTime
																						};
																						Trajectory
																							.push(
																								Trajectoryinfo
																								);
																						uni.setStorageSync(
																							'Trajectory',
																							Trajectory
																							);
																						/* that.wxRequest({
																							url: `${that.API}/driverService/uploadMinilocus`,
																							method: 'POST',
																							data: {
																								trackType: 3,
																								loadingOrderId: taskvalue.loadingOrderId,
																								list: Trajectory,
																								vehicleNo: taskvalue.vehicleNo,
																								driverTel: uni.getStorageSync(that.DATA_KEY.userInfo).mobile
																							},
																							success: res => {
																								console.log('上传坐标点成功', res)
																								Trajectory = [];
																								uni.setStorageSync('Trajectory', Trajectory);
																							},
																							fail: error => {
																								console.log('上传坐标点失败')
																								Trajectory = [];
																								uni.setStorageSync('Trajectory', Trajectory);
																							},
																						}); */

																						that.wxRequest({
																							url: `${that.API}/fance/waybillFence/cronJsFance`,
																							method: 'POST',
																							data: {
																								vehicleNo: taskvalue
																									.vehicleNo,
																								driverTel: uni
																									.getStorageSync(
																										that
																										.DATA_KEY
																										.userInfo
																										)
																									.mobile,
																								trackType: 3,
																								driverId: uni
																									.getStorageSync(
																										that
																										.DATA_KEY
																										.userInfo
																										)
																									.driverId,
																								loadingOrderId: taskvalue
																									.loadingOrderId,
																								lat: latitude,
																								lng: longitude
																							},
																							success: res => {
																								console
																									.log(
																										res
																										)
																							}
																						});
																					},
																					fail: (
																						err) => {
																						uni.showToast({
																							title: "位置定位失败，请查看定位权限是否开启",
																							icon: "none"
																						})
																					}
																				});
																				console
																					.log(
																						'发送定位结果',
																						ret
																						.code
																						);
																			}
																		);
																	that.Interval =
																		setInterval(
																			() => {
																				//上传坐标点
																				// 调用异步方法启动定位
																				console
																					.log(
																						'd======================调用异步方法启动定位 '
																						);
																				locationModule
																					.start({
																							appSecurity: taskvalue
																								.appSecurity,
																							enterpriseSenderCode: taskvalue
																								.enterpriseSenderCode,
																							ShippingNoteNumber: taskvalue
																								.loadingOrderId,
																							StartCountrySubdivisionCode: taskvalue
																								.shippingRegionCode,
																							EndCountrySubdivisionCode: taskvalue
																								.receiptRegionCode,
																							StartLongitude: taskvalue
																								.StartLongitude,
																							StartLatitude: taskvalue
																								.StartLatitude,
																							EndLongitude: taskvalue
																								.EndLongitude,
																							EndLatitude: taskvalue
																								.EndLatitude,
																							StartLocationText: taskvalue
																								.shippingCity,
																							EndLocationText: taskvalue
																								.receiptCity,
																							VehicleNumber: taskvalue
																								.vehicleNo,
																							DriverName: taskvalue
																								.driverName
																						},
																						ret => {
																							let rets =
																								ret
																								.code;
																							uni.getLocation({
																								type: 'wgs84',
																								success: function(
																									res
																									) {
																									let longitude =
																										res
																										.longitude;
																									let latitude =
																										res
																										.latitude;
																									if (rets ==
																										'发送定位send成功'
																										) {
																										uni.setStorageSync(
																											'loadingOrderId',
																											taskvalue
																											.loadingOrderId
																											);
																										//发送定位回调
																										uni.request({
																											url: `https://sign.y2t.com/tax/taxInfoUpload`,
																											method: 'POST',
																											data: {
																												vehicleNumber: taskvalue
																													.vehicleNo,
																												driverName: taskvalue
																													.driverName,
																												shippingNoteNumber: taskvalue
																													.loadingOrderId,
																												longitude: longitude,
																												latitude: latitude,
																												status: 1
																											},
																											success: res => {
																												uni
																											.hideLoading();
																												console
																													.log(
																														'发送定位回调结果',
																														res
																														);
																											},
																											fail: error => {
																												uni
																											.hideLoading();
																												uni.showToast({
																													title: '网络异常！',
																													icon: 'none'
																												});
																											},
																											complete: res => {
																												if (obj
																													.complete
																													)
																													obj
																													.complete(
																														res
																														);
																											}
																										});
																										console
																											.log(
																												'====================================',
																												taskvalue
																												.loadingOrderId
																												);
																									}

																									//上传坐标点
																									let currentTime =
																										new Date()
																										.getTime();
																									let Trajectory = []
																									let Trajectoryinfo = {
																										lat: latitude,
																										lng: longitude,
																										positionTime: currentTime
																									};
																									Trajectory
																										.push(
																											Trajectoryinfo
																											);
																									uni.setStorageSync(
																										'Trajectory',
																										Trajectory
																										);
																									/* that.wxRequest({
																										url: `${that.API}/driverService/uploadMinilocus`,
																										method: 'POST',
																										data: {
																											trackType: 3,
																											loadingOrderId: taskvalue.loadingOrderId,
																											list: Trajectory,
																											vehicleNo: taskvalue.vehicleNo,
																											driverTel: uni.getStorageSync(that.DATA_KEY.userInfo).mobile
																										},
																										success: res => {
																											console.log('上传坐标点成功', res)
																											Trajectory = [];
																											uni.setStorageSync('Trajectory', Trajectory);
																										},
																										fail: error => {
																											console.log('上传坐标点失败')
																											Trajectory = [];
																											uni.setStorageSync('Trajectory', Trajectory);
																										},
																									}); */

																									that.wxRequest({
																										url: `${that.API}/fance/waybillFence/cronJsFance`,
																										method: 'POST',
																										data: {
																											vehicleNo: taskvalue
																												.vehicleNo,
																											driverTel: uni
																												.getStorageSync(
																													that
																													.DATA_KEY
																													.userInfo
																													)
																												.mobile,
																											trackType: 3,
																											driverId: uni
																												.getStorageSync(
																													that
																													.DATA_KEY
																													.userInfo
																													)
																												.driverId,
																											loadingOrderId: taskvalue
																												.loadingOrderId,
																											lat: latitude,
																											lng: longitude
																										},
																										success: res => {
																											console
																												.log(
																													res
																													)
																										}
																									});
																								},
																								fail: err => {
																									uni.showToast({
																										title: "位置定位失败，请查看定位权限是否开启",
																										icon: "none"
																									})
																								}
																							});
																							console
																								.log(
																									'发送定位结果',
																									ret
																									.code
																									);
																							// uni.showModal({
																							// 	title: '提示',
																							// 	content: ret.code,
																							// 	showCancel: false,
																							// 	success: function(res) {
																							// 		if (res.confirm) {
																							// 			console.log('用户点击确定');
																							// 		}
																							// 	}
																							// });
																						}
																					);
																			},
																			180000
																			);
																	that.checkinFun(
																		taskvalue
																		)
																} else if (res1
																	.cancel) {
																	console.log(
																		'用户点击取消'
																		);
																}
															}
														})
													}
												}
											})
										} else {
											that.guijiUpload2(taskvalue, 1)
											//上传坐标点
											locationModule.start({
													appSecurity: taskvalue.appSecurity,
													enterpriseSenderCode: taskvalue
														.enterpriseSenderCode,
													ShippingNoteNumber: taskvalue.loadingOrderId,
													StartCountrySubdivisionCode: taskvalue
														.shippingRegionCode,
													EndCountrySubdivisionCode: taskvalue
														.receiptRegionCode,
													StartLongitude: taskvalue.StartLongitude,
													StartLatitude: taskvalue.StartLatitude,
													EndLongitude: taskvalue.EndLongitude,
													EndLatitude: taskvalue.EndLatitude,
													StartLocationText: taskvalue.shippingCity,
													EndLocationText: taskvalue.receiptCity,
													VehicleNumber: taskvalue.vehicleNo,
													DriverName: taskvalue.driverName
												},
												ret => {
													let rets = ret.code;
													uni.getLocation({
														type: 'wgs84',
														success: function(res) {
															let longitude = res.longitude;
															let latitude = res.latitude;
															if (rets == '发送定位send成功') {
																uni.setStorageSync(
																	'loadingOrderId',
																	taskvalue
																	.loadingOrderId);
																//发送定位回调
																uni.request({
																	url: `https://sign.y2t.com/tax/taxInfoUpload`,
																	method: 'POST',
																	data: {
																		vehicleNumber: taskvalue
																			.vehicleNo,
																		driverName: taskvalue
																			.driverName,
																		shippingNoteNumber: taskvalue
																			.loadingOrderId,
																		longitude: longitude,
																		latitude: latitude,
																		status: 1
																	},
																	success: res => {
																		uni
																	.hideLoading();
																		console
																			.log(
																				'发送定位回调结果',
																				res
																				);
																	},
																	fail: error => {
																		uni
																	.hideLoading();
																		uni.showToast({
																			title: '网络异常！',
																			icon: 'none'
																		});
																	},
																	complete: res => {
																		if (obj
																			.complete
																			)
																			obj
																			.complete(
																				res
																				);
																	}
																});
																console.log(
																	'====================================',
																	taskvalue
																	.loadingOrderId);
															}
															//上传坐标点
															let currentTime = new Date()
																.getTime();
															let Trajectory = []
															let Trajectoryinfo = {
																lat: latitude,
																lng: longitude,
																positionTime: currentTime
															};
															Trajectory.push(
															Trajectoryinfo);
															uni.setStorageSync(
																'Trajectory',
																Trajectory);
															that.wxRequest({
																url: `${that.API}/driverService/uploadMinilocus`,
																method: 'POST',
																data: {
																	trackType: 3,
																	loadingOrderId: taskvalue
																		.loadingOrderId,
																	list: Trajectory,
																	vehicleNo: taskvalue
																		.vehicleNo,
																	driverTel: uni
																		.getStorageSync(
																			that
																			.DATA_KEY
																			.userInfo
																			)
																		.mobile
																},
																success: res => {
																	console
																		.log(
																			'上传坐标点成功',
																			res
																			)
																	Trajectory
																		= [];
																	uni.setStorageSync(
																		'Trajectory',
																		Trajectory
																		);
																},
																fail: error => {
																	console
																		.log(
																			'上传坐标点失败'
																			)
																	Trajectory
																		= [];
																	uni.setStorageSync(
																		'Trajectory',
																		Trajectory
																		);
																},
															});
														},
														fail: (err) => {
															uni.showToast({
																title: "位置定位失败，请查看定位权限是否开启",
																icon: "none"
															})
														}
													});
													console.log('发送定位结果', ret.code);
												}
											);
											that.Interval = setInterval(() => {
												//上传坐标点
												// 调用异步方法启动定位
												console.log('d======================调用异步方法启动定位 ');
												locationModule.start({
														appSecurity: taskvalue.appSecurity,
														enterpriseSenderCode: taskvalue
															.enterpriseSenderCode,
														ShippingNoteNumber: taskvalue
															.loadingOrderId,
														StartCountrySubdivisionCode: taskvalue
															.shippingRegionCode,
														EndCountrySubdivisionCode: taskvalue
															.receiptRegionCode,
														StartLongitude: taskvalue
															.StartLongitude,
														StartLatitude: taskvalue.StartLatitude,
														EndLongitude: taskvalue.EndLongitude,
														EndLatitude: taskvalue.EndLatitude,
														StartLocationText: taskvalue
															.shippingCity,
														EndLocationText: taskvalue.receiptCity,
														VehicleNumber: taskvalue.vehicleNo,
														DriverName: taskvalue.driverName
													},
													ret => {
														let rets = ret.code;
														uni.getLocation({
															type: 'wgs84',
															success: function(res) {
																let longitude = res
																	.longitude;
																let latitude = res
																	.latitude;
																if (rets ==
																	'发送定位send成功') {
																	uni.setStorageSync(
																		'loadingOrderId',
																		taskvalue
																		.loadingOrderId
																		);
																	//发送定位回调
																	uni.request({
																		url: `https://sign.y2t.com/tax/taxInfoUpload`,
																		method: 'POST',
																		data: {
																			vehicleNumber: taskvalue
																				.vehicleNo,
																			driverName: taskvalue
																				.driverName,
																			shippingNoteNumber: taskvalue
																				.loadingOrderId,
																			longitude: longitude,
																			latitude: latitude,
																			status: 1
																		},
																		success: res => {
																			uni
																		.hideLoading();
																			console
																				.log(
																					'发送定位回调结果',
																					res
																					);
																		},
																		fail: error => {
																			uni
																		.hideLoading();
																			uni.showToast({
																				title: '网络异常！',
																				icon: 'none'
																			});
																		},
																		complete: res => {
																			if (obj
																				.complete
																				)
																				obj
																				.complete(
																					res
																					);
																		}
																	});
																	console.log(
																		'====================================',
																		taskvalue
																		.loadingOrderId
																		);
																}

																//上传坐标点
																let currentTime =
																	new Date()
																	.getTime();
																let Trajectory = []
																let Trajectoryinfo = {
																	lat: latitude,
																	lng: longitude,
																	positionTime: currentTime
																};
																Trajectory.push(
																	Trajectoryinfo
																	);
																uni.setStorageSync(
																	'Trajectory',
																	Trajectory);
																that.wxRequest({
																	url: `${that.API}/driverService/uploadMinilocus`,
																	method: 'POST',
																	data: {
																		trackType: 3,
																		loadingOrderId: taskvalue
																			.loadingOrderId,
																		list: Trajectory,
																		vehicleNo: taskvalue
																			.vehicleNo,
																		driverTel: uni
																			.getStorageSync(
																				that
																				.DATA_KEY
																				.userInfo
																				)
																			.mobile
																	},
																	success: res => {
																		console
																			.log(
																				'上传坐标点成功',
																				res
																				)
																		Trajectory
																			= [];
																		uni.setStorageSync(
																			'Trajectory',
																			Trajectory
																			);
																	},
																	fail: error => {
																		console
																			.log(
																				'上传坐标点失败'
																				)
																		Trajectory
																			= [];
																		uni.setStorageSync(
																			'Trajectory',
																			Trajectory
																			);
																	},
																});
															},
															fail: err => {
																uni.showToast({
																	title: "位置定位失败，请查看定位权限是否开启",
																	icon: "none"
																})
															}
														});
														console.log('发送定位结果', ret.code);
														// uni.showModal({
														// 	title: '提示',
														// 	content: ret.code,
														// 	showCancel: false,
														// 	success: function(res) {
														// 		if (res.confirm) {
														// 			console.log('用户点击确定');
														// 		}
														// 	}
														// });
													}
												);
											}, 180000);
											that.checkinFun(taskvalue)
										}
									}
								})
							} else if (taskvalue.nextCheckinNodeName == '到达') {
								//结束定位
								// #ifdef APP-PLUS
								that.wxRequest({
									url: `${that.API}/fance/waybillFence/createCircleFenceIsSuccess?waybillId=${taskvalue.waybillId}`,
									method: 'get',
									title: '加载中...',
									success: res => {
										if (res.data.data && res.data.data.fenceStatus == 1) {
											that.wxRequest({
												url: `${that.API}/fance/waybillFence/getShippingStatus?id=${taskvalue.loadingOrderId}`,
												method: 'get',
												title: '加载中...',
												success: re => {
													if (re.data.data.shippingStatus == 3) {
														that.page = 1;
														that.onwaybill(that.mescroll);
													} else {
														uni.showModal({
															title: '提示',
															content: '未检测到您进入指定区域送货后出发，是否确认到达？',
															success: res1 => {
																if (res1.confirm) {
																	//上传坐标点
																	clearInterval(
																		that
																		.Interval
																		);
																	that.guijiUpload1(taskvalue, 2)
																	// 调用异步方法终止定位
																	locationModule
																		.stop({
																				appSecurity: taskvalue
																					.appSecurity,
																				enterpriseSenderCode: taskvalue
																					.enterpriseSenderCode,
																				ShippingNoteNumber: uni
																					.getStorageSync(
																						'loadingOrderId'
																						),
																				StartCountrySubdivisionCode: taskvalue
																					.shippingRegionCode,
																				EndCountrySubdivisionCode: taskvalue
																					.receiptRegionCode,
																				StartLongitude: taskvalue
																					.StartLongitude,
																				StartLatitude: taskvalue
																					.StartLatitude,
																				EndLongitude: taskvalue
																					.EndLongitude,
																				EndLatitude: taskvalue
																					.EndLatitude,
																				StartLocationText: taskvalue
																					.shippingCity,
																				EndLocationText: taskvalue
																					.receiptCity,
																				VehicleNumber: taskvalue
																					.vehicleNo,
																				DriverName: taskvalue
																					.driverName
																			},
																			ret => {
																				let rets =
																					ret
																					.code;
																				uni.getLocation({
																					type: 'wgs84',
																					geocode: true,
																					success: function(
																						res
																						) {
																						let longitude =
																							res
																							.longitude;
																						let latitude =
																							res
																							.latitude;
																						if (rets ==
																							'停止定位stop成功'
																							) {
																							uni.setStorageSync(
																								'loadingOrderId',
																								''
																								);
																							//发送定位回调
																							uni.request({
																								url: `https://sign.y2t.com/tax/taxInfoUpload`,
																								method: 'POST',
																								data: {
																									vehicleNumber: taskvalue
																										.vehicleNo,
																									driverName: taskvalue
																										.driverName,
																									shippingNoteNumber: taskvalue
																										.loadingOrderId,
																									longitude: longitude,
																									latitude: latitude,
																									status: 2
																								},
																								success: res => {
																									uni
																								.hideLoading();
																									console
																										.log(
																											'发送定位回调结果',
																											res
																											);
																								},
																								fail: error => {
																									uni
																								.hideLoading();
																									uni.showToast({
																										title: '网络异常！',
																										icon: 'none'
																									});
																								},
																								complete: res => {
																									if (obj
																										.complete
																										)
																										obj
																										.complete(
																											res
																											);
																								}
																							});
																							console
																								.log(
																									'====================================',
																									taskvalue
																									.loadingOrderId
																									);
																						}

																						//上传坐标点
																						let currentTime =
																							new Date()
																							.getTime();
																						let Trajectory = []
																						let Trajectoryinfo = {
																							lat: latitude,
																							lng: longitude,
																							positionTime: currentTime
																						};
																						Trajectory
																							.push(
																								Trajectoryinfo
																								);
																						uni.setStorageSync(
																							'Trajectory',
																							Trajectory
																							);
																						that.wxRequest({
																							url: `${that.API}/driverService/uploadMinilocus`,
																							method: 'POST',
																							data: {
																								trackType: 3,
																								loadingOrderId: taskvalue
																									.loadingOrderId,
																								list: Trajectory,
																								vehicleNo: taskvalue
																									.vehicleNo,
																								driverTel: uni
																									.getStorageSync(
																										that
																										.DATA_KEY
																										.userInfo
																										)
																									.mobile
																							},
																							success: res => {
																								console
																									.log(
																										'上传坐标点成功',
																										res
																										)
																								Trajectory
																									= [];
																								uni.setStorageSync(
																									'Trajectory',
																									Trajectory
																									);
																							},
																							fail: error => {
																								console
																									.log(
																										'上传坐标点失败'
																										)
																								Trajectory
																									= [];
																								uni.setStorageSync(
																									'Trajectory',
																									Trajectory
																									);
																							},
																						});

																						/* that.wxRequest({
																							url: `${that.API}/fance/waybillFence/cronJsFance`,
																							method: 'POST',
																							data: {
																								vehicleNo: taskvalue.vehicleNo,
																								driverTel: uni.getStorageSync(that.DATA_KEY.userInfo).mobile,
																								trackType: 3,
																								driverId: uni.getStorageSync(that.DATA_KEY.userInfo).driverId,
																								loadingOrderId: taskvalue.loadingOrderId,
																								lat: latitude,
																								lng: longitude
																							},
																							success: res => {
																								console.log(res)
																							}
																						}); */
																					},
																					fail: err => {
																						uni.showToast({
																							title: "位置定位失败，请查看定位权限是否开启",
																							icon: "none"
																						})
																					}
																				});
																			}
																		);
																	that.checkinFun(
																		taskvalue
																		)
																} else if (res1
																	.cancel) {
																	console.log(
																		'用户点击取消'
																		);
																}
															}
														})
													}
												}
											})
										} else {
											//上传坐标点
											clearInterval(that.Interval);
											that.guijiUpload2(taskvalue, 2)
											// 调用异步方法终止定位
											locationModule.stop({
													appSecurity: taskvalue.appSecurity,
													enterpriseSenderCode: taskvalue
														.enterpriseSenderCode,
													ShippingNoteNumber: uni.getStorageSync(
														'loadingOrderId'),
													StartCountrySubdivisionCode: taskvalue
														.shippingRegionCode,
													EndCountrySubdivisionCode: taskvalue
														.receiptRegionCode,
													StartLongitude: taskvalue.StartLongitude,
													StartLatitude: taskvalue.StartLatitude,
													EndLongitude: taskvalue.EndLongitude,
													EndLatitude: taskvalue.EndLatitude,
													StartLocationText: taskvalue.shippingCity,
													EndLocationText: taskvalue.receiptCity,
													VehicleNumber: taskvalue.vehicleNo,
													DriverName: taskvalue.driverName
												},
												ret => {
													let rets = ret.code;
													uni.getLocation({
														type: 'wgs84',
														geocode: true,
														success: function(res) {
															let longitude = res.longitude;
															let latitude = res.latitude;
															if (rets == '停止定位stop成功') {
																uni.setStorageSync(
																	'loadingOrderId',
																	'');
																//发送定位回调
																uni.request({
																	url: `https://sign.y2t.com/tax/taxInfoUpload`,
																	method: 'POST',
																	data: {
																		vehicleNumber: taskvalue
																			.vehicleNo,
																		driverName: taskvalue
																			.driverName,
																		shippingNoteNumber: taskvalue
																			.loadingOrderId,
																		longitude: longitude,
																		latitude: latitude,
																		status: 2
																	},
																	success: res => {
																		uni
																	.hideLoading();
																		console
																			.log(
																				'发送定位回调结果',
																				res
																				);
																	},
																	fail: error => {
																		uni
																	.hideLoading();
																		uni.showToast({
																			title: '网络异常！',
																			icon: 'none'
																		});
																	},
																	complete: res => {
																		if (obj
																			.complete
																			)
																			obj
																			.complete(
																				res
																				);
																	}
																});
																console.log(
																	'====================================',
																	taskvalue
																	.loadingOrderId);
															}

															//上传坐标点
															let currentTime = new Date()
																.getTime();
															let Trajectory = []
															let Trajectoryinfo = {
																lat: latitude,
																lng: longitude,
																positionTime: currentTime
															};
															Trajectory.push(
															Trajectoryinfo);
															uni.setStorageSync(
																'Trajectory',
																Trajectory);
															that.wxRequest({
																url: `${that.API}/driverService/uploadMinilocus`,
																method: 'POST',
																data: {
																	trackType: 3,
																	loadingOrderId: taskvalue
																		.loadingOrderId,
																	list: Trajectory,
																	vehicleNo: taskvalue
																		.vehicleNo,
																	driverTel: uni
																		.getStorageSync(
																			that
																			.DATA_KEY
																			.userInfo
																			)
																		.mobile
																},
																success: res => {
																	console
																		.log(
																			'上传坐标点成功',
																			res
																			)
																	Trajectory
																		= [];
																	uni.setStorageSync(
																		'Trajectory',
																		Trajectory
																		);
																},
																fail: error => {
																	console
																		.log(
																			'上传坐标点失败'
																			)
																	Trajectory
																		= [];
																	uni.setStorageSync(
																		'Trajectory',
																		Trajectory
																		);
																},
															});
														},
														fail: err => {
															uni.showToast({
																title: "位置定位失败，请查看定位权限是否开启",
																icon: "none"
															})
														}
													});
												}
											);
											that.checkinFun(taskvalue)
										}
									}
								})
								// #endif
							} else {
								that.checkinFun(taskvalue)
							}
							return
							// #ifdef MP-WEIXIN
							that.signChannel = 2;
							// #endif
							// #ifdef APP-PLUS
							that.signChannel = 1;
							// #endif
							if (that.nextCheckinWriteShippedNum == 0 && that.nextCheckinWriteReceiptedNum == 0 && that
								.nextCheckinUploadPicture == 0) {
								that.wxRequest({
									url: `${that.API}/miniApp/loadingOrder/checkin`,
									method: 'POST',
									data: {
										clickLocation: 1,
										loadingOrderId: that.orderloadingOrderId,
										checkinSeq: that.ordercheckinSeq,
										signChannel: that.signChannel
									},
									title: '加载中...',
									success: res => {
										if (taskvalue.nextCheckinNodeName == '到达') {
											let obj = res.data.data[0];
											that.tasklist = that.tasklist.map(item => item
												.loadingOrderId === obj.loadingOrderId ? obj : item)
										} else {
											that.page = 1;
											that.onwaybill(that.mescroll);
										}
									}
								});
							} else {
								if (that.imageurl.length > 0) {
									that.imageurl = '';
									that.imageData = [];
								}
								that.shippedNum = '';
								that.receiptedNum = '';
								uni.setStorageSync('image', 1);
								that.unitStr = taskvalue.unitStr;
								that.$refs.popup2.open('center');
								if (that.unitStr === '车' || that.unitStr === '箱') {
									that.shippedNum = 1;
									that.receiptedNum = 1;
								}
							}
						} else {
							uni.showModal({
								title: '该程序需要获取您的当前位置',
								confirmText: '去授权',
								showCancel: false,
								success(res) {
									if (res.confirm) {
										permision.gotoAppPermissionSetting();
									}
								}
							});
						}
					}
				} else if (uni.getSystemInfoSync().platform == 'ios') {
					//获取当前的地理位置、速度
					uni.getLocation({
						type: 'wgs84', //返回gps坐标
						success: function(res) {
							console.log('uni.getLocation success');
							that.$forceUpdate();
							islocation = true;
							that.orderloadingOrderId = taskvalue.loadingOrderId;
							that.ordercheckinSeq = taskvalue.nextCheckinSeq;
							that.CheckinNodeName = taskvalue.nextCheckinNodeName
							that.nextCheckinWriteShippedNum = taskvalue.nextCheckinWriteShippedNum;
							that.nextCheckinWriteReceiptedNum = taskvalue.nextCheckinWriteReceiptedNum;
							that.nextCheckinUploadPicture = taskvalue.nextCheckinUploadPicture;
							// uni.showModal({
							// 	title: '打印起始经纬度',
							// 	content: `StartLongitude: ${taskvalue.StartLongitude};StartLatitude:${taskvalue.StartLatitude};EndLongitude: ${taskvalue.EndLongitude}; EndLatitude: ${taskvalue.EndLatitude}`
							// })
							if (taskvalue.nextCheckinNodeName == '起运') {
								//启动定位
								// #ifdef APP-PLUS
								that.wxRequest({
									url: `${that.API}/fance/waybillFence/createCircleFenceIsSuccess?waybillId=${taskvalue.waybillId}`,
									method: 'get',
									title: '加载中...',
									success: res => {
										if (res.data.data && res.data.data.fenceStatus == 1) {
											that.wxRequest({
												url: `${that.API}/fance/waybillFence/getShippingStatus?id=${taskvalue.loadingOrderId}`,
												method: 'get',
												title: '加载中...',
												success: re => {
													if (re.data.data
														.shippingStatus == 2) {
														that.page = 1;
														that.onwaybill(that
															.mescroll);
													} else {
														uni.showModal({
															title: '提示',
															content: '未检测到您进入指定区域取货后出发，是否确认起运？',
															success: res1 => {
																if (res1
																	.confirm
																	) {
																	that.guijiUpload1(taskvalue, 1)
																	//上传坐标点
																	that.checkinFun(
																		taskvalue
																		)
																	locationModule
																		.start({
																				appSecurity: taskvalue
																					.appSecurity,
																				enterpriseSenderCode: taskvalue
																					.enterpriseSenderCode,
																				ShippingNoteNumber: taskvalue
																					.loadingOrderId,
																				StartCountrySubdivisionCode: taskvalue
																					.shippingRegionCode,
																				EndCountrySubdivisionCode: taskvalue
																					.receiptRegionCode,
																				StartLongitude: taskvalue
																					.StartLongitude,
																				StartLatitude: taskvalue
																					.StartLatitude,
																				EndLongitude: taskvalue
																					.EndLongitude,
																				EndLatitude: taskvalue
																					.EndLatitude,
																				StartLocationText: taskvalue
																					.shippingCity,
																				EndLocationText: taskvalue
																					.receiptCity,
																				VehicleNumber: taskvalue
																					.vehicleNo,
																				DriverName: taskvalue
																					.driverName
																			},
																			ret => {
																				let rets =
																					ret
																					.code;
																				uni.getLocation({
																					type: 'wgs84',
																					success: (
																						res
																						) => {
																						let longitude =
																							res
																							.longitude;
																						let latitude =
																							res
																							.latitude;
																						if (rets ==
																							'发送定位send成功'
																							) {
																							uni.setStorageSync(
																								'loadingOrderId',
																								taskvalue
																								.loadingOrderId
																								);
																							//发送定位回调
																							uni.request({
																								url: `https://sign.y2t.com/tax/taxInfoUpload`,
																								method: 'POST',
																								data: {
																									vehicleNumber: taskvalue
																										.vehicleNo,
																									driverName: taskvalue
																										.driverName,
																									shippingNoteNumber: taskvalue
																										.loadingOrderId,
																									longitude: longitude,
																									latitude: latitude,
																									status: 1
																								},
																								success: res => {
																									uni
																								.hideLoading();
																									// uni.showToast({
																									// 	title:"起点发送定位"
																									// })
																									// uni.showToast({
																									// 	title:res
																									// })
																									console
																										.log(
																											'发送定位回调结果',
																											res
																											);
																								},
																								fail: error => {
																									uni
																								.hideLoading();
																									uni.showToast({
																										title: '网络异常！',
																										icon: 'none'
																									});
																								},
																								complete: res => {
																									if (obj
																										.complete
																										)
																										obj
																										.complete(
																											res
																											);
																								}
																							});
																							console
																								.log(
																									'====================================',
																									taskvalue
																									.loadingOrderId
																									);
																						}
																						//上传坐标点
																						let currentTime =
																							new Date()
																							.getTime();
																						let Trajectory = []
																						let Trajectoryinfo = {
																							lat: latitude,
																							lng: longitude,
																							positionTime: currentTime
																						};
																						Trajectory
																							.push(
																								Trajectoryinfo
																								);
																						uni.setStorageSync(
																							'Trajectory',
																							Trajectory
																							);
																						/* that.wxRequest({
																							url: `${that.API}/driverService/uploadMinilocus`,
																							method: 'POST',
																							data: {
																								trackType: 3,
																								loadingOrderId: taskvalue.loadingOrderId,
																								list: Trajectory,
																								vehicleNo: taskvalue.vehicleNo,
																								driverTel: uni.getStorageSync(that.DATA_KEY.userInfo).mobile
																							},
																							success: res => {
																								console.log('上传坐标点成功', res)
																								Trajectory = [];
																								uni.setStorageSync('Trajectory', Trajectory);
																							},
																							fail: error => {
																								console.log('上传坐标点失败')
																								Trajectory = [];
																								uni.setStorageSync('Trajectory', Trajectory);
																							},
																						}); */

																						that.wxRequest({
																							url: `${that.API}/fance/waybillFence/cronJsFance`,
																							method: 'POST',
																							data: {
																								vehicleNo: taskvalue
																									.vehicleNo,
																								driverTel: uni
																									.getStorageSync(
																										that
																										.DATA_KEY
																										.userInfo
																										)
																									.mobile,
																								trackType: 3,
																								driverId: uni
																									.getStorageSync(
																										that
																										.DATA_KEY
																										.userInfo
																										)
																									.driverId,
																								loadingOrderId: taskvalue
																									.loadingOrderId,
																								lat: latitude,
																								lng: longitude
																							},
																							success: res => {
																								console
																									.log(
																										res
																										)
																							}
																						});
																					},
																					fail: async (
																						err) => {
																						uni.showToast({
																							title: "位置定位失败，请查看定位权限是否开启",
																							icon: "none"
																						})
																					}
																				});
																				console
																					.log(
																						'发送定位结果',
																						ret
																						.code
																						);
																			}
																		);
																	
																} else if (
																	res1
																	.cancel
																	) {
																	console
																		.log(
																			'用户点击取消'
																			);
																}
															}
														})
													}
												}
											})
										} else {
											//上传坐标点
											that.guijiUpload2(taskvalue, 1)
											// uni.getLocation({
											// 	type: 'wgs84',
											// 	success: (res) => {
											// 		let currentTime = new Date()
											// 			.getTime();
											// 		let Trajectory = []
											// 		let Trajectoryinfo = {
											// 			lat: res.latitude,
											// 			lng: res.longitude,
											// 			positionTime: currentTime
											// 		};
											// 		Trajectory.push(
											// 		Trajectoryinfo);
											// 		uni.setStorageSync(
											// 			'Trajectory',
											// 			Trajectory);
											// 		that.wxRequest({
											// 			url: `${that.API}/driverService/uploadMinilocus`,
											// 			method: 'POST',
											// 			data: {
											// 				trackType: 3,
											// 				loadingOrderId: taskvalue
											// 					.loadingOrderId,
											// 				list: Trajectory,
											// 				vehicleNo: taskvalue
											// 					.vehicleNo,
											// 				driverTel: uni
											// 					.getStorageSync(
											// 						that
											// 						.DATA_KEY
											// 						.userInfo
											// 						)
											// 					.mobile
											// 			},
											// 			success: res => {
											// 				// uni.showModal({
											// 				// 	title: `${taskvalue.loadingOrderId}上传坐标点......`+JSON.stringify(res.data)
											// 				// })
											// 				Trajectory
											// 					= [];
											// 				uni.setStorageSync(
											// 					'Trajectory',
											// 					Trajectory
											// 					);
											// 			}
											// 		});
											// 	},
											// 	fail: async (err) => {
											// 		let loc = await that.LunLocation()
											// 		if (loc) {
											// 			let currentTime = new Date()
											// 				.getTime();
											// 			let Trajectory = []
											// 			let Trajectoryinfo = {
											// 				lat: loc.latitude,
											// 				lng: loc.longitude,
											// 				positionTime: currentTime
											// 			};
											// 			Trajectory.push(
											// 			Trajectoryinfo);
											// 			uni.setStorageSync(
											// 				'Trajectory',
											// 				Trajectory);
											// 			that.wxRequest({
											// 				url: `${that.API}/driverService/uploadMinilocus`,
											// 				method: 'POST',
											// 				data: {
											// 					trackType: 3,
											// 					loadingOrderId: taskvalue
											// 						.loadingOrderId,
											// 					list: Trajectory,
											// 					vehicleNo: taskvalue
											// 						.vehicleNo,
											// 					driverTel: uni
											// 						.getStorageSync(
											// 							that
											// 							.DATA_KEY
											// 							.userInfo
											// 							)
											// 						.mobile
											// 				},
											// 				success: res => {
											// 					// uni.showModal({
											// 					// 	title: `${taskvalue.loadingOrderId}上传坐标点......`+JSON.stringify(res.data)
											// 					// })
											// 					Trajectory
											// 						= [];
											// 					uni.setStorageSync(
											// 						'Trajectory',
											// 						Trajectory
											// 						);
											// 				}
											// 			});
											// 		}
											// 	}
											// })
											that.checkinFun(taskvalue)
											locationModule.start({
													appSecurity: taskvalue.appSecurity,
													enterpriseSenderCode: taskvalue
														.enterpriseSenderCode,
													ShippingNoteNumber: taskvalue
														.loadingOrderId,
													StartCountrySubdivisionCode: taskvalue
														.shippingRegionCode,
													EndCountrySubdivisionCode: taskvalue
														.receiptRegionCode,
													StartLongitude: taskvalue
														.StartLongitude,
													StartLatitude: taskvalue.StartLatitude,
													EndLongitude: taskvalue.EndLongitude,
													EndLatitude: taskvalue.EndLatitude,
													StartLocationText: taskvalue
														.shippingCity,
													EndLocationText: taskvalue.receiptCity,
													VehicleNumber: taskvalue.vehicleNo,
													DriverName: taskvalue.driverName
												},
												ret => {
													console.log('uni latitude = ', ret);
													let longitude = ret.longitude;
													let latitude = ret.latitude;
													if (ret.code == '发送定位send成功') {
														uni.setStorageSync(
															'loadingOrderId', taskvalue
															.loadingOrderId);
														//发送定位回调
														uni.request({
															url: `https://sign.y2t.com/tax/taxInfoUpload`,
															method: 'POST',
															data: {
																vehicleNumber: taskvalue
																	.vehicleNo,
																driverName: taskvalue
																	.driverName,
																shippingNoteNumber: taskvalue
																	.loadingOrderId,
																longitude: longitude,
																latitude: latitude,
																status: 1
															},
															success: res => {
																uni
															.hideLoading();
																console.log(
																	'发送定位回调结果',
																	res);
															},
															fail: error => {
																uni
															.hideLoading();
																uni.showToast({
																	title: '网络异常！',
																	icon: 'none'
																});
															},
															complete: res => {
																if (obj
																	.complete)
																	obj
																	.complete(
																		res);
															}
														});
														console.log(
															'====================================',
															taskvalue.loadingOrderId);
													}

													let currentTime = new Date().getTime();
													let Trajectory = []
													let Trajectoryinfo = {
														lat: latitude,
														lng: longitude,
														positionTime: currentTime
													};
													Trajectory.push(Trajectoryinfo);
													uni.setStorageSync('Trajectory',
														Trajectory);
													that.wxRequest({
														url: `${that.API}/driverService/uploadMinilocus`,
														method: 'POST',
														data: {
															trackType: 3,
															loadingOrderId: taskvalue
																.loadingOrderId,
															list: Trajectory,
															vehicleNo: taskvalue
																.vehicleNo,
															driverTel: uni
																.getStorageSync(
																	that.DATA_KEY
																	.userInfo)
																.mobile
														},
														success: res => {
															console.log(
																'上传坐标点成功',
																res)
															Trajectory = [];
															uni.setStorageSync(
																'Trajectory',
																Trajectory);
														},
														fail: error => {
															console.log(
																'上传坐标点失败')
															Trajectory = [];
															uni.setStorageSync(
																'Trajectory',
																Trajectory);
														},
													});
												}
											);
										}
									}
								})
								// #endif
							} else if (taskvalue.nextCheckinNodeName == '到达') {
								//结束定位
								// #ifdef APP-PLUS
								that.wxRequest({
									url: `${that.API}/fance/waybillFence/createCircleFenceIsSuccess?waybillId=${taskvalue.waybillId}`,
									method: 'get',
									title: '加载中...',
									success: res => {
										if (res.data.data && res.data.data.fenceStatus == 1) {
											that.wxRequest({
												url: `${that.API}/fance/waybillFence/getShippingStatus?id=${taskvalue.loadingOrderId}`,
												method: 'get',
												title: '加载中...',
												success: re => {
													if (re.data.data
														.shippingStatus == 3) {
														that.page = 1;
														that.onwaybill(that
															.mescroll);
													} else {
														uni.showModal({
															title: '提示',
															content: '未检测到您进入指定区域送货后出发，是否确认到达？',
															success: res1 => {
																if (res1
																	.confirm
																	) {
																	//上传坐标点
																	clearInterval
																		(that
																			.Interval
																			);
																	that.guijiUpload1(taskvalue, 2)
																	// uni.getLocation({
																	// 	type: 'wgs84',
																	// 	success: async (res) => {
																	// 		if (!(Object.prototype.toString.call(res) === '[object Object]' && res.latitude && res.longitude)) {
																	// 			let loc = await that.LunLocation()
																	// 			res = loc
																	// 		}
																	// 		that.wxRequest({
																	// 			url: `${that.API}/fance/waybillFence/cronJsFance`,
																	// 			method: 'POST',
																	// 			data: {
																	// 				vehicleNo: taskvalue
																	// 					.vehicleNo,
																	// 				driverTel: uni
																	// 					.getStorageSync(
																	// 						that
																	// 						.DATA_KEY
																	// 						.userInfo
																	// 						)
																	// 					.mobile,
																	// 				trackType: 3,
																	// 				driverId: uni
																	// 					.getStorageSync(
																	// 						that
																	// 						.DATA_KEY
																	// 						.userInfo
																	// 						)
																	// 					.driverId,
																	// 				loadingOrderId: taskvalue
																	// 					.loadingOrderId,
																	// 				lat: res.latitude,
																	// 				lng: res.longitude
																	// 			},
																	// 			success: res => {
																	// 				console
																	// 					.log(
																	// 						res
																	// 						)
																	// 			}
																	// 		});
																	// 	},
																	// 	fail: async (err) => {
																	// 		let loc = await that.LunLocation()
																	// 		if (loc) {
																	// 			that.wxRequest({
																	// 				url: `${that.API}/fance/waybillFence/cronJsFance`,
																	// 				method: 'POST',
																	// 				data: {
																	// 					vehicleNo: taskvalue
																	// 						.vehicleNo,
																	// 					driverTel: uni
																	// 						.getStorageSync(
																	// 							that
																	// 							.DATA_KEY
																	// 							.userInfo
																	// 							)
																	// 						.mobile,
																	// 					trackType: 3,
																	// 					driverId: uni
																	// 						.getStorageSync(
																	// 							that
																	// 							.DATA_KEY
																	// 							.userInfo
																	// 							)
																	// 						.driverId,
																	// 					loadingOrderId: taskvalue
																	// 						.loadingOrderId,
																	// 					lat: loc.latitude,
																	// 					lng: loc.longitude
																	// 				},
																	// 				success: res => {
																	// 					console
																	// 						.log(
																	// 							res
																	// 							)
																	// 				}
																	// 			});
																	// 		}
																	// 	}
																	// })
																	that.checkinFun(
																		taskvalue
																		)
																	// 调用异步方法终止定位
																	locationModule
																		.stop({
																				appSecurity: taskvalue
																					.appSecurity,
																				enterpriseSenderCode: taskvalue
																					.enterpriseSenderCode,
																				ShippingNoteNumber: uni
																					.getStorageSync(
																						'loadingOrderId'
																						),
																				StartCountrySubdivisionCode: taskvalue
																					.shippingRegionCode,
																				EndCountrySubdivisionCode: taskvalue
																					.receiptRegionCode,
																				StartLongitude: taskvalue
																					.StartLongitude,
																				StartLatitude: taskvalue
																					.StartLatitude,
																				EndLongitude: taskvalue
																					.EndLongitude,
																				EndLatitude: taskvalue
																					.EndLatitude,
																				StartLocationText: taskvalue
																					.shippingCity,
																				EndLocationText: taskvalue
																					.receiptCity,
																				VehicleNumber: taskvalue
																					.vehicleNo,
																				DriverName: taskvalue
																					.driverName
																			},
																			ret => {
																				let rets =
																					ret
																					.code;
																				uni.getLocation({
																					type: 'wgs84',
																					geocode: true,
																					success: (
																						res
																						) => {
																						let longitude =
																							res
																							.longitude;
																						let latitude =
																							res
																							.latitude;
																						if (rets ==
																							'停止定位stop成功'
																							) {
																							uni.setStorageSync(
																								'loadingOrderId',
																								''
																								);
																							//发送定位回调
																							uni.request({
																								url: `https://sign.y2t.com/tax/taxInfoUpload`,
																								method: 'POST',
																								data: {
																									vehicleNumber: taskvalue
																										.vehicleNo,
																									driverName: taskvalue
																										.driverName,
																									shippingNoteNumber: taskvalue
																										.loadingOrderId,
																									longitude: longitude,
																									latitude: latitude,
																									status: 2
																								},
																								success: res => {
																									uni
																								.hideLoading();
																									//app测试使用
																									uni.showModal({
																										title: `发送定位回调结果`
																									})
																									uni.showModal({
																										title: res
																									})
																									console
																										.log(
																											'发送定位回调结果',
																											res
																											);
																								},
																								fail: error => {
																									uni
																								.hideLoading();
																									uni.showToast({
																										title: '网络异常！',
																										icon: 'none'
																									});
																								},
																								complete: res => {
																									if (obj
																										.complete
																										)
																										obj
																										.complete(
																											res
																											);
																								}
																							});
																							console
																								.log(
																									'====================================',
																									taskvalue
																									.loadingOrderId
																									);
																						}

																						//上传坐标点
																						let currentTime =
																							new Date()
																							.getTime();
																						let Trajectory = []
																						let Trajectoryinfo = {
																							lat: latitude,
																							lng: longitude,
																							positionTime: currentTime
																						};
																						Trajectory
																							.push(
																								Trajectoryinfo
																								);
																						uni.setStorageSync(
																							'Trajectory',
																							Trajectory
																							);
																						/* that.wxRequest({
																							url: `${that.API}/driverService/uploadMinilocus`,
																							method: 'POST',
																							data: {
																								trackType: 3,
																								loadingOrderId: taskvalue.loadingOrderId,
																								list: Trajectory,
																								vehicleNo: taskvalue.vehicleNo,
																								driverTel: uni.getStorageSync(that.DATA_KEY.userInfo).mobile
																							},
																							success: res => {
																								console.log('上传坐标点成功', res)
																								Trajectory = [];
																								uni.setStorageSync('Trajectory', Trajectory);
																							},
																							fail: error => {
																								console.log('上传坐标点失败')
																								Trajectory = [];
																								uni.setStorageSync('Trajectory', Trajectory);
																							},
																						}); */

																						that.wxRequest({
																							url: `${that.API}/fance/waybillFence/cronJsFance`,
																							method: 'POST',
																							data: {
																								vehicleNo: taskvalue
																									.vehicleNo,
																								driverTel: uni
																									.getStorageSync(
																										that
																										.DATA_KEY
																										.userInfo
																										)
																									.mobile,
																								trackType: 3,
																								driverId: uni
																									.getStorageSync(
																										that
																										.DATA_KEY
																										.userInfo
																										)
																									.driverId,
																								loadingOrderId: taskvalue
																									.loadingOrderId,
																								lat: latitude,
																								lng: longitude
																							},
																							success: res => {
																								console
																									.log(
																										res
																										)
																							}
																						});
																					},
																					fail: err => {
																						uni.showToast({
																							title: "位置定位失败，请查看定位权限是否开启",
																							icon: "none"
																						})
																					}
																				});
																			}
																		);
																	
																} else if (
																	res1
																	.cancel
																	) {
																	console
																		.log(
																			'用户点击取消'
																			);
																}
															}
														})
													}
												}
											})
										} else {
											clearInterval(that.Interval);
											that.guijiUpload2(taskvalue, 2)
											// 调用异步方法终止定位
											//上传坐标点
											// uni.getLocation({
											// 	type: 'wgs84',
											// 	success: async (res) => {
											// 		if (!(Object.prototype.toString.call(res) === '[object Object]' && res.latitude && res.longitude)) {
											// 			let loc = await that.LunLocation()
											// 			res = loc
											// 		}
											// 		let currentTime = new Date()
											// 			.getTime();
											// 		let Trajectory = []
											// 		let Trajectoryinfo = {
											// 			lat: res.latitude,
											// 			lng: res.longitude,
											// 			positionTime: currentTime
											// 		};
											// 		Trajectory.push(
											// 		Trajectoryinfo);
											// 		uni.setStorageSync(
											// 			'Trajectory',
											// 			Trajectory);
											// 		that.wxRequest({
											// 			url: `${that.API}/driverService/uploadMinilocus`,
											// 			method: 'POST',
											// 			data: {
											// 				trackType: 3,
											// 				loadingOrderId: taskvalue
											// 					.loadingOrderId,
											// 				list: Trajectory,
											// 				vehicleNo: taskvalue
											// 					.vehicleNo,
											// 				driverTel: uni
											// 					.getStorageSync(
											// 						that
											// 						.DATA_KEY
											// 						.userInfo
											// 						)
											// 					.mobile
											// 			},
											// 			success: res => {
											// 				// uni.showModal({
											// 				// 	title: `${taskvalue.loadingOrderId}上传坐标点到达`+JSON.stringify(res.data)
											// 				// })
											// 				Trajectory
											// 					= [];
											// 				uni.setStorageSync(
											// 					'Trajectory',
											// 					Trajectory
											// 					);
											// 			}
											// 		});
											// 	},
											// 	fail: async (err) => {
											// 		let loc = await that.LunLocation()
											// 		if (loc) {
											// 			let currentTime = new Date()
											// 				.getTime();
											// 			let Trajectory = []
											// 			let Trajectoryinfo = {
											// 				lat: res.latitude,
											// 				lng: res.longitude,
											// 				positionTime: currentTime
											// 			};
											// 			Trajectory.push(
											// 			Trajectoryinfo);
											// 			uni.setStorageSync(
											// 				'Trajectory',
											// 				Trajectory);
											// 			that.wxRequest({
											// 				url: `${that.API}/driverService/uploadMinilocus`,
											// 				method: 'POST',
											// 				data: {
											// 					trackType: 3,
											// 					loadingOrderId: taskvalue
											// 						.loadingOrderId,
											// 					list: Trajectory,
											// 					vehicleNo: taskvalue
											// 						.vehicleNo,
											// 					driverTel: uni
											// 						.getStorageSync(
											// 							that
											// 							.DATA_KEY
											// 							.userInfo
											// 							)
											// 						.mobile
											// 				},
											// 				success: res => {
											// 					// uni.showModal({
											// 					// 	title: `${taskvalue.loadingOrderId}上传坐标点到达`+JSON.stringify(res.data)
											// 					// })
											// 					Trajectory
											// 						= [];
											// 					uni.setStorageSync(
											// 						'Trajectory',
											// 						Trajectory
											// 						);
											// 				}
											// 			});
											// 		}
											// 	}
											// })
											that.checkinFun(taskvalue)
											locationModule.stop({
													appSecurity: taskvalue.appSecurity,
													enterpriseSenderCode: taskvalue
														.enterpriseSenderCode,
													ShippingNoteNumber: uni.getStorageSync(
														'loadingOrderId'),
													StartCountrySubdivisionCode: taskvalue
														.shippingRegionCode,
													EndCountrySubdivisionCode: taskvalue
														.receiptRegionCode,
													StartLongitude: taskvalue
														.StartLongitude,
													StartLatitude: taskvalue.StartLatitude,
													EndLongitude: taskvalue.EndLongitude,
													EndLatitude: taskvalue.EndLatitude,
													StartLocationText: taskvalue
														.shippingCity,
													EndLocationText: taskvalue.receiptCity,
													VehicleNumber: taskvalue.vehicleNo,
													DriverName: taskvalue.driverName
												},
												ret => {
													let rets = ret.code;
													// uni.showModal({
													// 	title: '提示',
													// 	content: rets,
													// 	showCancel: false,
													// 	success: function(res) {}
													// });
													uni.getLocation({
														type: 'wgs84',
														success: function(res) {
															let longitude = res
																.longitude;
															let latitude = res
																.latitude;
															if (rets ==
																'停止定位stop成功') {
																uni.setStorageSync(
																	'loadingOrderId',
																	'');
																//发送定位回调
																uni.request({
																	url: `https://sign.y2t.com/tax/taxInfoUpload`,
																	method: 'POST',
																	data: {
																		vehicleNumber: taskvalue
																			.vehicleNo,
																		driverName: taskvalue
																			.driverName,
																		shippingNoteNumber: taskvalue
																			.loadingOrderId,
																		longitude: longitude,
																		latitude: latitude,
																		status: 2
																	},
																	success: res => {
																		uni
																	.hideLoading();
																		console
																			.log(
																				'发送定位回调结果',
																				res
																				);
																	},
																	fail: error => {
																		uni
																	.hideLoading();
																		uni.showToast({
																			title: '网络异常！',
																			icon: 'none'
																		});
																	},
																	complete: res => {
																		if (obj
																			.complete
																			)
																			obj
																			.complete(
																				res
																				);
																	}
																});
																console.log(
																	'====================================',
																	taskvalue
																	.loadingOrderId
																	);
															}
														}
													});

												}
											);
											
										}
									}
								})
								// #endif
							} else {
								that.checkinFun(taskvalue)
							}
							return
							// #ifdef MP-WEIXIN
							that.signChannel = 2;
							// #endif
							// #ifdef APP-PLUS
							that.signChannel = 1;
							// #endif

							if (that.nextCheckinWriteShippedNum == 0 && that
								.nextCheckinWriteReceiptedNum == 0 && that.nextCheckinUploadPicture == 0) {
								that.wxRequest({
									url: `${that.API}/miniApp/loadingOrder/checkin`,
									method: 'POST',
									data: {
										clickLocation: 1,
										loadingOrderId: that.orderloadingOrderId,
										checkinSeq: that.ordercheckinSeq,
										signChannel: that.signChannel
									},
									title: '加载中...',
									success: res => {
										if (taskvalue.nextCheckinNodeName == '到达') {
											let obj = res.data.data[0];
											that.tasklist = that.tasklist.map(item => item
												.loadingOrderId === obj.loadingOrderId ?
												obj : item)
										} else {
											that.page = 1;
											that.onwaybill(that.mescroll);
										}
									}
								});
							} else {
								if (that.imageurl.length > 0) {
									that.imageurl = '';
									that.imageData = [];
								}
								that.shippedNum = '';
								that.receiptedNum = '';
								uni.setStorageSync('image', 1);
								that.unitStr = taskvalue.unitStr;
								that.$refs.popup2.open('center');
								if (that.unitStr === '车' || that.unitStr === '箱') {
									that.shippedNum = 1;
									that.receiptedNum = 1;
								}
							}

						},
						fail: (result) => {
							console.log('uni.getLocation fail');
							uni.showModal({
								title: '提示',
								content: '请开启手机gps定位,设置-隐私-位置',
								showCancel: false,
								success: function(res) {}
							});
						}
					});

				}
				// #endif
				this.getMessage()
			},
			checkinFun(taskvalue) {
				return new Promise(async (resole, reject) => {
					let that = this
					// #ifdef MP-WEIXIN
					that.signChannel = 2;
					// #endif
					// #ifdef APP-PLUS
					that.signChannel = 1;
					// #endif
					if (that.nextCheckinWriteShippedNum == 0 && that.nextCheckinWriteReceiptedNum == 0 && that
						.nextCheckinUploadPicture == 0) {
						that.wxRequest({
							url: `${that.API}/miniApp/loadingOrder/checkin`,
							method: 'POST',
							data: {
								clickLocation: 1,
								loadingOrderId: that.orderloadingOrderId,
								checkinSeq: that.ordercheckinSeq,
								signChannel: that.signChannel
							},
							title: '加载中...',
							success: res => {
								resole()
								if (taskvalue.nextCheckinNodeName == '到达') {
									let obj = res.data.data[0];
									that.tasklist = that.tasklist.map(item => item.loadingOrderId === obj
										.loadingOrderId ? obj : item)
								} else {
									that.page = 1;
									that.onwaybill(that.mescroll);
								}
							}
						});
					} else {
						if (this.nextCheckinUploadPicture == 1) {
							let isSignShow = await that.$refs.signPop.beforeShow(taskvalue)
							if (isSignShow) {
								that.signPopShow = true
								return
							}
						}
						console.log('999999')
						if (that.imageurl.length > 0) {
							that.imageurl = '';
							that.imageData = [];
						}
						that.shippedNum = '';
						that.receiptedNum = '';
						uni.setStorageSync('image', 1);
						that.unitStr = taskvalue.unitStr;
						that.$refs.popup2.open('center');
						if (that.unitStr === '车' || that.unitStr === '箱') {
							that.shippedNum = 1;
							that.receiptedNum = 1;
						}
						// uni.navigateTo({
						// 	url: '/pages/index/receipt'
						// })
					}
				})
			},
			//提交
			submit() {
				const data = {};
				data.loadingOrderId = this.orderloadingOrderId;
				data.checkinSeq = this.ordercheckinSeq;
				data.signChannel = this.signChannel;
				data.clickLocation = 1;
				if (this.nextCheckinWriteShippedNum == 1) {
					if (this.shippedNum == '') {
						uni.showToast({
							title: '请填写装货数量',
							duration: 2000,
							icon: 'none'
						});
						return;
					} else {
						if (this.unitStr === '吨') {
							let reg = /^(([1-9]{1}\d{0,1})|(0{1}))(\.\d{1,4})?$/
							if (!reg.test(this.shippedNum)) {
								uni.showToast({
									title: '装货量小数点前最多2位，小数点后最多4位',
									icon: 'none'
								})
								return
							}
						}
						if (this.unitStr === '立方' || this.unitStr === '纸箱') {
							let reg = /^(([1-9]{1}\d{0,2})|(0{1}))(\.\d{1,2})?$/
							if (!reg.test(this.shippedNum)) {
								uni.showToast({
									title: '装货量小数点前最多3位，小数点后最多2位',
									icon: 'none'
								})
								return
							}
						}
						if (this.unitStr === '件') {
							let reg = /^[1-9]\d{0,3}$/
							if (!reg.test(this.shippedNum)) {
								uni.showToast({
									title: '装货量最多4位整数',
									icon: 'none'
								})
								return
							}
						}
						if (this.unitStr.includes('集装箱')) {
							let reg = /^[12]$/;
							if (!reg.test(this.shippedNum)) {
								uni.showToast({
									title: '请输入正确的运输数量',
									icon: 'none'
								})
								return
							}
						}
						data.shippedNum = this.shippedNum;
					}
				}
				if (this.nextCheckinWriteReceiptedNum == 1) {
					if (this.receiptedNum == '') {
						uni.showToast({
							title: '请填写卸货数量',
							duration: 2000,
							icon: 'none'
						});
						return;
					} else {
						if (this.unitStr === '吨') {
							let reg = /^(([1-9]{1}\d{0,1})|(0{1}))(\.\d{1,4})?$/
							if (!reg.test(this.receiptedNum)) {
								uni.showToast({
									title: '卸货量小数点前最多2位，小数点后最多4位',
									icon: 'none'
								})
								return
							}
						}
						if (this.unitStr === '立方' || this.unitStr === '纸箱') {
							let reg = /^(([1-9]{1}\d{0,2})|(0{1}))(\.\d{1,2})?$/
							if (!reg.test(this.receiptedNum)) {
								uni.showToast({
									title: '卸货量小数点前最多3位，小数点后最多2位',
									icon: 'none'
								})
								return
							}
						}
						if (this.unitStr === '件') {
							let reg = /^[1-9]\d{0,3}$/
							if (!reg.test(this.receiptedNum)) {
								uni.showToast({
									title: '卸货量最多4位整数',
									icon: 'none'
								})
								return
							}
						}
						if (this.unitStr.includes('集装箱')) {
							let reg = /^[12]$/;
							if (!reg.test(this.receiptedNum)) {
								uni.showToast({
									title: '请输入正确的运输数量',
									icon: 'none'
								})
								return
							}
						}
						data.receiptedNum = this.receiptedNum;
					}
				}
				if (this.nextCheckinUploadPicture == 1) {
					if (this.imageurl == '') {
						uni.showToast({
							title: '请上传图片',
							duration: 2000
						});
						return;
					} else {
						data.receiptCheckPictures = this.imageurl;
					}
				}
				let that = this;
				that.$refs.popup2.close();
				that.wxRequest({
					url: `${that.API}/miniApp/loadingOrder/checkin`,
					method: 'POST',
					data: data,
					title: '加载中...',
					success: res => {
						if (that.CheckinNodeName == '到达') {
							let obj = res.data.data[0];
							that.tasklist = that.tasklist.map(item => item.loadingOrderId === obj
								.loadingOrderId ? obj : item)
						} else {
							that.page = 1;
							that.onwaybill(that.mescroll);
						}
					}
				});
			},
			// 小程序上传位置
			onwaybill(mescroll) {
				let that = this;
				if (mescroll != null && (that.page == 0 || that.page == 1)) {
					that.mescroll.scrollTo(0, 0)
				}
				this.$nextTick(() => {
					console.log(that.mobile)
					console.log(uni.getStorageSync(that.DATA_KEY.userInfo).mobile)
					that.wxRequest({
						url: `${that.API}/miniApp/loadingOrder/driverLoadingOrderPage`,
						method: 'POST',
						data: {
							pageNo: that.page,
							pageSize: that.pageSize,
							etpId: that.etpId,
							queryType: 1,
							// tel: uni.getStorageSync(that.DATA_KEY.userInfo).mobile
						},
						title: '加载中...',
						success: res => {
							let list = res.data.data.list;
							if (that.page == 1) {
								that.tasklist = [];
							}
							for (let i = 0; i < list.length; i++) {
								list[i].iscustNo = 0;
								list[i].StartLongitude = list[i].shippingLng
								list[i].StartLatitude = list[i].shippingLat
								list[i].EndLongitude = list[i].receiptLng
								list[i].EndLatitude = list[i].receiptLat
								//获取起运市区的经纬度
								// that.wxRequestData({
								// 	url: `https://restapi.amap.com/v3/geocode/geo?key=95415c2325d40e02db55eca83da41848&address=` +
								// 		list[i].shippingCity, //shippingCity  起运市区
								// 	method: 'GET',
								// 	success: res => {
								// 		console.log(res, '3333333333333')
								// 		list[i].StartLongitude = res.data.geocodes[0]
								// 			.location.split(',')[0];
								// 		list[i].StartLatitude = res.data.geocodes[0]
								// 			.location.split(',')[1];
								// 	}
								// });
								// //获取到达市区的经纬度
								// that.wxRequestData({
								// 	url: `https://restapi.amap.com/v3/geocode/geo?key=95415c2325d40e02db55eca83da41848&address=` +
								// 		list[i].receiptCity, //receiptCity  到达市区
								// 	method: 'GET',
								// 	success: res => {
								// 		list[i].EndLongitude = res.data.geocodes[0]
								// 			.location.split(',')[0];
								// 		list[i].EndLatitude = res.data.geocodes[0].location
								// 			.split(',')[1];
								// 	}
								// });
								that.tasklist.push(list[i]);
							}
							// that.tasklist = res.data.data.list;
							if (mescroll != null) {
								mescroll.endBySize(that.tasklist.length, res.data.data.total);
								setTimeout(() => {
									that.mescroll.endSuccess(that.tasklist.length);
								}, 20);
							}

							// for (let i = 0; i < that.tasklist.length; i++) {
							// 	if (that.tasklist[i].shippingStatus == 2) {
							// 		uni.setStorageSync(that.DATA_KEY.loadingOrderId, that.tasklist[i].loadingOrderId);
							// 		let Trajectory = [];
							// 		uni.setStorageSync('Trajectory', Trajectory);
							// 		// that.Interval = setInterval(function() {
							// 		// 	console.log('轨迹点  Interval ');
							// 		wx.startLocationUpdateBackground({
							// 			success: res => {
							// 				console.log('轨迹点  startLocationUpdateBackground ');
							// 				wx.onLocationChange(data => {
							// 					console.log('轨迹点  onLocationChange ');
							// 					var currentTime = new Date().getTime();
							// 					var oldTime = uni.getStorageSync(that.DATA_KEY.oldTime);
							// 					console.log('起运  时间 ', currentTime, oldTime, currentTime - oldTime > 180000);
							// 					if (currentTime - oldTime > 180000) {
							// 						uni.setStorageSync(that.DATA_KEY.oldTime, currentTime);
							// 						let Trajectory = [];
							// 						console.log('轨迹点0   ', uni.getStorageSync('Trajectory'));
							// 						console.log('轨迹点1   ', !uni.getStorageSync('Trajectory'));
							// 						if (uni.getStorageSync('Trajectory').length == 0) {
							// 							Trajectory = [];
							// 						} else {
							// 							Trajectory = uni.getStorageSync('Trajectory');
							// 						}
							// 						console.log('运单号0   ', uni.getStorageSync(that.DATA_KEY.loadingOrderId) != '');
							// 						let Trajectoryinfo = {
							// 							lat: data.latitude,
							// 							lng: data.longitude,
							// 							positionTime: currentTime
							// 						};
							// 						Trajectory.push(Trajectoryinfo);
							// 						uni.setStorageSync('Trajectory', Trajectory);
							// 						console.log('轨迹数据 ', uni.getStorageSync('Trajectory'));
							// 						that.wxRequest({
							// 							url: `${that.API}/driverService/uploadMinilocus`,
							// 							method: 'POST',
							// 							data: {
							// 								loadingOrderId: uni.getStorageSync(that.DATA_KEY.loadingOrderId),
							// 								list: Trajectory,
							// 								vehicleNo: that.tasklist[i].vehicleNo,
							// 								driverTel: uni.getStorageSync(that.DATA_KEY.userInfo).mobile
							// 							},
							// 							success: res => {
							// 								Trajectory = [];
							// 								uni.setStorageSync('Trajectory', Trajectory);
							// 							}
							// 						});
							// 					}
							// 				});
							// 			},
							// 			fail: res => {
							// 				console.log('获取位置失败', res);
							// 			}
							// 		});
							// 		// }, 2000);
							// 	}
							// }
							// let isst = false;
							// for (let i = 0; i < that.tasklist.length; i++) {
							// 	if (that.tasklist[i].shippingStatus == 2) {
							// 		isst = true;
							// 	}
							// }
							// console.log('ddss 是否', isst);
							// if (!isst) {
							// 	// clearInterval(that.Interval);
							// 	wx.stopLocationUpdate({
							// 		success: res => {
							// 			console.log('关闭位置成功', res);
							// 		},
							// 		fail: res => {
							// 			console.log('关闭位置失败', res);
							// 		}
							// 	});
							// }
						},
						complete: res => {
							//  请求失败,隐藏加载状态
							if (mescroll != null) {
								setTimeout(() => {
									that.mescroll.endSuccess();
								}, 20);
							}
						}
					});
				})

			},
			onmyCorp() {
				if (uni.getStorageSync(this.DATA_KEY.userInfo).mobile) {
					if (!this.etpId && !this.etpName) {
						this.wxRequest({
							url: `${this.API}/driverService/getEtpList?is_enable=1&driver_id=` + uni
								.getStorageSync(this.DATA_KEY.userInfo).driverId,
							method: 'POST',
							success: res => {
								let list = res.data.data.list;
								this.count = 0;
								for (let i = 0; i < list.length; i++) {
									if (!this.etpId && !this.etpName) {
										this.etpId = list[0].etpId;
										this.etpName = list[0].etpName;
										this.count = list[0].count;
										uni.setStorageSync(this.DATA_KEY.etpId, this.etpId);
										uni.setStorageSync(this.DATA_KEY.etpName, this.etpName);
										// return;
									} else {
										if (this.etpId == list[i].etpId) {
											this.count = list[i].count;
										}
									}
									// if (list[i].status == 1) {
									// 	this.etpId = list[i].etpId;
									// 	this.etpName = list[i].etpName;
									// 	uni.setStorageSync(this.DATA_KEY.etpId, this.etpId);
									// 	uni.setStorageSync(this.DATA_KEY.etpName, this.etpName);
									// 	return;
									// }
								}
								this.onwaybill(this.mescroll);
								if (this.count > 0) {
									uni.showTabBarRedDot({
										index: 0
									});
								} else {
									uni.hideTabBarRedDot({
										index: 0
									});
								}
							}
						});
					} else {
						this.page = 1;
						this.onwaybill(this.mescroll);
					}
				}
			},
			getQueryVariable(url, variable) {
				var vars = url.split('&');
				for (var i = 0; i < vars.length; i++) {
					var pair = vars[i].split('=');
					if (pair[0] == variable) {
						return pair[1];
					}
				}
				return false;
			},
			async clos4() {
				this.$refs.popup4.close();
				let isSignShow = await this.$refs.batchSignPop.beforeShow()
				if (isSignShow) {
					this.batchSignPopShow = true
				} else {
					this.batchSignPopShow = false
				}
			},
			clos6() {
				this.$refs.popup6.close();
			},
			onVerifyMobile() {
				var reg = 11 && /^((13|14|15|16|17|18|19)[0-9]{1}\d{8})$/;
				if (this.mobile == '' && this.mobile != null) {
					uni.showToast({
						title: '请输入手机号码',
						icon: 'none'
					});
					return
				} else if (!reg.test(this.mobile)) {
					uni.showToast({
						title: '手机格式不正确',
						icon: 'none'
					});
					return
				}
				if (this.checkCode == '') {
					uni.showToast({
						title: '请输入验证码',
						icon: 'none'
					});
					return;
				}
				this.wxRequest({
					url: `${this.API}/driverService/doVerifyMobile`,
					method: 'POST',
					data: {
						driverId: this.userInfo.driverId,
						realMobile: this.mobile,
						checkCode: this.checkCode
					},
					title: '验证中...',
					success: res => {
						if (res.data.data.status == 1) {
							this.errtext = res.data.data.message;
						} else {
							this.errtext = '';
							uni.showToast({
								title: '恭喜，您当前手机号已实名验证成功！',
								icon: 'none'
							});
							this.$refs.popup6.close();
						}
					}
				});
			},
			onreal(raalidex) {
				// this.realNameStatus = res.data.data.realNameStatus;
				// this.vehicleStatus = res.data.data.vehicleStatus;
				// 		this.flagindex = -1;
				// 		this.realNameStext = '未实名'
				// 		this.vehicleStext

				switch (raalidex) {
					case 0: //实名认证
						if(this.isRealName == 1 && this.realNameStatus == 0){
							uni.navigateTo({
								url: `../personal/informationSting`
							});
							return
						}
						if(this.isRealName == 1 && this.realNameStatus == 1&& this.driverStatustip == 5){
							uni.navigateTo({
								url: `../personal/informationSting`
							});
							return
						}
						if(this.isRealName == 1 && this.realNameStatus == 1&& this.driverStatustip == 5){
							uni.navigateTo({
								url: `../personal/informationSting`
							});
							return
						}
						if (this.userInfo.idcard == '' || this.realNameStatus != 1) {
							if (this._driverStatus == 4) {
								uni.navigateTo({
									url: `../personal/informationSting`
								});
								return
							}
							uni.navigateTo({
								url: `../personal/driverregistration?isdriverId=true`
							});
						} else {
							uni.navigateTo({
								url: `../personal/personaldocuments`
							});
						}
						break;
					case 1: //车辆认证
						// if (this.userInfo.idcard == '' || this.realNameStatus != 1) {
						// 	uni.navigateTo({
						// 		url: `../personal/driverregistration?isdriverId=true`
						// 	});
						// } else {
						// 	uni.navigateTo({
						// 		url: `../personal/vehiclelist`
						// 	});
						// }
						if (this.realNameStext == '未认证') {
							uni.navigateTo({
								url: `../personal/driverregistration?isdriverId=true`
							});
						} else {
							uni.navigateTo({
								url: `/pages/vehicle/vehiclelist`
							});
						}
						break;
						// case 2: //签约状态
						// 	if (this.userInfo.idcard == '' || this.realNameStatus != 1) {
						// 		uni.navigateTo({
						// 			url: `../personal/driverregistration?isdriverId=true`
						// 		});
						// 	} else if(this.vehicleStatus != 1){
						// 		uni.navigateTo({
						// 			url: `../personal/vehiclelist`
						// 		});
						// 	}else if(this.signStatus != 1){
						// 		uni.navigateTo({
						// 			url: `../personal/signinglist`
						// 		});
						// 	}
						// 	break;
					case 3: //实名认证状态
						if (this.userInfo.idcard == '' || this.realNameStatus != 1) {
							uni.navigateTo({
								url: `../personal/driverregistration?isdriverId=true`
							});
						} else if (this.vehicleStatus != 1) {
							uni.navigateTo({
								url: `/pages/vehicle/vehiclelist`
							});
							// }else if(this.signStatus != 1){
							// 	if(this.platformCoNo != '0001'){
							// 		uni.navigateTo({
							// 			url: `../personal/signinglist`
							// 		});
							// 	}else{
							// 		uni.navigateTo({
							// 			url: '../personal/annualvisa?platformCoNo=' + this.platformCoNo
							// 		});
							// 	}
						} else if (this.realMobileStatus != 1) {
							this.$refs.popup4.close();
							this.$refs.popup6.open('center');
							this.errtext = '';
						}
						break;
					default:
						break;
				}
			},
			onrealverif(res) {
				let that = this;
				
				/* if(res.data.data.statusFlag == 1){
					that.realNameStatus = res.data.data.realNameStatus;
					that.isRealName = res.data.data.isRealName;  // 新加的字段
					that.vehicleStatus = res.data.data.vehicleStatus;
					that.signStatus = res.data.data.signStatus;
					that.realMobileStatus = res.data.data.realMobileStatus;
					that.platformCoName = res.data.data.platformCoName;
					that.platformCoNo = res.data.data.platformCoNo;
					switch (
						that.realNameStatus //实名状态
					) {
						case '0':
							that.flagindex = -1;
							if(res.data.data.driverStatus == 4){
								that.realNameStext = '申诉中';
							}else {
								that.realNameStext = '未认证';
							}
							break;
						case '1':
							that.flagindex = 0;
							if(res.data.data.driverStatus == 4){
								that.realNameStext = '申诉中';
							}else {
								that.realNameStext = '已实名';
							}
							break;
						case '2':
							that.flagindex = -1;
							if(res.data.data.driverStatus == 4){
								that.realNameStext = '申诉中';
							}else {
								that.realNameStext = '已过期';
							}
							break;
					}
					switch (
						that.vehicleStatus//车辆认证状态
					) {
						case '0':
							if(res.data.data.vehicleEtpSize>0){
								that.vehicleStext = '申诉中';
							}else{
								that.vehicleStext = '未认证';
							}
							break;
						case '1':
							if (that.flagindex != -1) {
								that.flagindex = 1;
							}
							if(res.data.data.vehicleEtpSize>0){
								that.vehicleStext = '申诉中';
							}else{
								that.vehicleStext = '已认证';
							}
							break;
						case '2':
							if(res.data.data.vehicleEtpSize>0){
								that.vehicleStext = '申诉中';
							}else{
								that.vehicleStext = '已过期';
							}
							break;
					}
					switch (
					that.signStatus //签约状态
					) {
						case '0':
							that.signStext = '未认证';
							break;
						case '1':
							// if (that.flagindex != -1) {
							// 	that.flagindex = 1;
							// }
							that.signStext = '已认证';
							break;
						case '2':
							that.signStext = '已过期';
							break;
					}
					switch (
					that.realMobileStatus //实名认证状态
					) {
						case '0':
							that.realMobileStext = '未认证';
							break;
						case '1':
							// if (that.flagindex != -1) {
							// 	that.flagindex = 1;
							// }
							that.realMobileStext = '已认证';
							break;
						case '2':
							that.realMobileStext = '已过期';
							break;
					}
					that.$refs.popup4.open('center');
				} */
				if (!res.data.data.flag) {
					that.realNameStatus = res.data.data.realNameStatus; //活体认证
					that.isRealName = res.data.data.isRealName; // 新加的字段
					that.vehicleStatus = res.data.data.vehicleStatus;
					that.signStatus = res.data.data.signStatus;
					that.realMobileStatus = res.data.data.realMobileStatus;
					that.platformCoName = res.data.data.platformCoName;
					that.platformCoNo = res.data.data.platformCoNo;
					
					if(that.isRealName == 0){
						that.realNameStext = '未认证';
						that.realNameFlag = false
						that.realNamedesc = '未实名认证'
						that.realNametTips = '请按提示完成个人信息认证'
						console.log('未认证')
					}
					if(that.realNameStatus == 2){
						that.realNameStext = '已过期';
						that.realNameFlag = false
						that.realNamedesc = '司机证件已过期'
						that.realNametTips = '证件已过期: 请及时更新'
					}
					if(res.data.data.driverStatus == 4){
						that.realNameStext = '申诉中';
						that.realNameFlag = false
						that.realNamedesc = '申诉中'
						that.realNametTips = '审核方:运必达平台'
						console.log('申诉中')
					}
					if(res.data.data.driverStatus == 3){
						that.realNameStext = '申诉驳回';
						that.realNameFlag = false
						that.realNamedesc = '申诉驳回'
						that.realNametTips = '审核方:运必达平台'
					}
					if(that.isRealName == 1 && that.realNameStatus == 0){
						that.realNameStext = '待认证';
						that.realNameFlag = false
						that.realNamedesc = '待认证'
						that.realNametTips = '请按提示完成税局实名认证'
					}
					
					if(that.isRealName == 1 && that.realNameStatus == 1&& res.data.data.driverStatus == 1){
						that.realNameStext = '企业审核中';
						that.realNameFlag = false
						that.realNamedesc = '企业审核中'
						that.realNametTips = `审核方:${that.etpName}`
						that.driverStatustip = res.data.data.driverStatus
					}
					if(that.isRealName == 1 && that.realNameStatus == 1&& res.data.data.driverStatus == 5){
						that.realNameStext = '企业驳回';
						that.realNameFlag = false
						that.realNamedesc = '审核驳回'
						that.realNametTips = `审核方:${that.etpName}`
						that.driverStatustip = res.data.data.driverStatus
					}
					if(that.isRealName == 1 && that.realNameStatus == 1&& res.data.data.driverStatus == 2){
						that.realNameStext = '已实名';
						that.realNameFlag = true
						that.realNamedesc = ''
						that.realNametTips = ``
						that.driverStatustip = res.data.data.driverStatus
					}
					
					// switch (
					// 	that.realNameStatus //活体   0-未实名;1-已实名;2-已过期  
					// 	//数据库实名  0-未实名;1-已实名;
					// ) {
					// 	// driverStatus : 1.待审核 2.通过 3.申诉驳回 4.申诉中 5.审核驳回 
					// 	case '0':
					// 		that.flagindex = -1;
					// 		if (res.data.data.driverStatus == 1) {
					// 			that.realNameStext = '待审核';
					// 			that.realNameFlag = false
					// 			that.realNamedesc = '未实名认证'
					// 			that.realNametTips = '请按提示完成税局实名认证'
					// 		} else if (res.data.data.driverStatus == 3) {
					// 			that.realNameStext = '申诉驳回';
					// 			that.realNameFlag = false
					// 			that.realNamedesc = '实名申诉驳回'
					// 			that.realNametTips = '审核方:运必达平台'
					// 		} else if (res.data.data.driverStatus == 4) {
					// 			that.realNameStext = '申诉中';
					// 			that.realNameFlag = true
					// 			that.realNamedesc = ''
					// 			that.realNametTips = '审核方:运必达平台'
					// 		}else if(res.data.data.driverStatus == 5){
					// 			that.realNameStext = '审核驳回';
					// 			that.realNameFlag = false
					// 			that.realNamedesc = '审核驳回'
					// 			that.realNametTips = `审核方:${that.etpName}`	
					// 		} else {
					// 			that.realNameStext = '未认证';
					// 			that.realNameFlag = false
					// 			that.realNamedesc = '司机未实名'
					// 			that.realNametTips = '请按提示完成个人信息认证'
					// 		}
					// 		break;
					// 	case '1':
					// 		that.flagindex = 0;
					// 		if (res.data.data.driverStatus == 1) {
					// 			that.realNameStext = '待审核';
					// 			that.realNameFlag = false
					// 			that.realNamedesc = '未实名认证'
					// 			that.realNametTips = `审核方:${that.etpName}`	
					// 		} else if (res.data.data.driverStatus == 3) {
					// 			that.realNameStext = '申诉驳回';
					// 			that.realNameFlag = false
					// 			that.realNamedesc = '实名申诉驳回'
					// 			that.realNametTips = '审核方:运必达平台'
					// 		} else if (res.data.data.driverStatus == 4) {
					// 			that.realNameStext = '申诉中';
					// 			that.realNameFlag = true
					// 			that.realNamedesc = ''
					// 			that.realNametTips = '审核方:运必达平台'
					// 		} else if(res.data.data.driverStatus == 5){
					// 			that.realNameStext = '审核驳回';
					// 			that.realNameFlag = false
					// 			that.realNamedesc = '审核驳回'
					// 			that.realNametTips = `审核方:${that.etpName}`	
					// 		} else {
					// 			that.realNameStext = '已实名';
					// 			that.realNameFlag = true
					// 			that.realNamedesc = ''
					// 			that.realNametTips = ''
					// 		}
					// 		break;
					// 	case '2':
					// 		that.flagindex = -1;
					// 		if (res.data.data.driverStatus == 1) {
					// 			that.realNameStext = '待审核';
					// 			that.realNameFlag = false
					// 			that.realNamedesc = '未实名认证'
					// 			that.realNametTips = `审核方:${that.etpName}`	
					// 		} else if (res.data.data.driverStatus == 3) {
					// 			that.realNameStext = '申诉驳回';
					// 			that.realNameFlag = false
					// 			that.realNamedesc = '实名申诉驳回'
					// 			that.realNametTips = '审核方:运必达平台'
					// 		} else if (res.data.data.driverStatus == 4) {
					// 			that.realNameStext = '申诉中';
					// 			that.realNameFlag = true
					// 			that.realNamedesc = ''
					// 			that.realNametTips = '审核方:运必达平台'
					// 		} else if(res.data.data.driverStatus == 5){
					// 			that.realNameStext = '审核驳回';
					// 			that.realNameFlag = false
					// 			that.realNamedesc = '审核驳回'
					// 			that.realNametTips =`审核方:${that.etpName}`	
					// 		} else {
					// 			that.realNameStext = '已过期';
					// 			that.realNameFlag = false
					// 			that.realNamedesc = '司机证件已过期'
					// 			that.realNametTips = '证件已过期: 请及时更新'
					// 		}
					// 		break;
					// }
					
					// vehicleEtpSize:申诉中统计
					//  vehicleEtpStatus1:待审核统计
					//   vehicleEtpStatus3:申诉驳回统计平台驳回
					//    vehicleEtpStatus32:审核驳回企业审核驳回
					
					//已过期
					// if (res.data.data.vehicleEtpSize <= 0) {
					// 	that.vehicleStext = '已过期';
					// 	that.vehicleFlag = false
					// 	that.vehicledesc = '车辆证件已过期'
					// 	that.vehicletTips = '证件已过期:请及时更新'
					// }
					
					switch (
						that.vehicleStatus //车辆认证状态0-未实名;1-已实名;2-已过期
					) {
						case '0':
						if (res.data.data.vehicleEtpStatus3 > 0) {
							if (res.data.data.vehicleEtpSize > 0) {
								that.vehicleStext = '申诉中';
								that.vehicleFlag = true
								that.vehicledesc = ''
								that.vehicletTips = '审核方:运必达平台'
							} else if(res.data.datavehicleEtpStatus32 > 0){
								that.vehicleStext = '审核驳回';
								that.vehicleFlag = false
								that.vehicledesc = '车辆审核驳回'
								that.vehicletTips = `审核方:${that.etpName}`	
							}else{
								that.vehicleStext = '申诉驳回';
								that.vehicleFlag = false
								that.vehicledesc = '车辆申诉驳回'
								that.vehicletTips = '审核方:运必达平台'
							}
						} else if (res.data.data.vehicleEtpSize > 0) {
							that.vehicleStext = '申诉中';
							that.vehicleFlag = true
							that.vehicledesc = ''
							that.vehicletTips = '审核方:运必达平台'
						}else if (res.data.data.vehicleEtpStatus32 > 0) {
							that.vehicleStext = '审核驳回';
							that.vehicleFlag = false
							that.vehicledesc = '车辆审核驳回'
							that.vehicletTips = `审核方:${that.etpName}`	
						
						}else if(res.data.data.vehicleEtpStatus1 > 0){
							that.vehicleStext = '待审核';
							that.vehicleFlag = true
							that.vehicledesc = ''
							that.vehicletTips = `审核方:${that.etpName}`
						} else {
							// (对的)
							that.vehicleStext = '未认证';
							that.vehicleFlag = false
							that.vehicledesc = '车辆未认证'
							that.vehicletTips = '请按提示完成车辆认证'
						}
						break;
						case '1':
							if (that.flagindex != -1) {
								that.flagindex = 1;
							}
							 if (res.data.data.vehicleEtpSize > 0) {
								that.vehicleStext = '申诉中';
								that.vehicleFlag = true
								that.vehicledesc = ''
							} else if (res.data.data.vehicleEtpStatus3 > 0) {
								if (res.data.data.vehicleEtpSize > 0) {
									that.vehicleStext = '申诉中';
									that.vehicleFlag = true
									that.vehicledesc = ''
									that.vehicletTips = '审核方:运必达平台'
								} else if(res.data.datavehicleEtpStatus32 > 0){
									that.vehicleStext = '审核驳回';
									that.vehicleFlag = false
									that.vehicledesc = '车辆审核驳回'
									that.vehicletTips = `审核方:${that.etpName}`	
								} else {
									that.vehicleStext = '审核驳回';
									that.vehicleFlag = false
									that.vehicledesc = '车辆审核驳回'
									that.vehicletTips = `审核方:${that.etpName}`
									
								}
							}else if (res.data.data.vehicleEtpStatus32 > 0) {
								that.vehicleStext = '审核驳回';
								that.vehicleFlag = false
								that.vehicledesc = '车辆审核驳回'
								that.vehicletTips = `审核方:${that.etpName}`	
							
							}else if(res.data.data.vehicleEtpStatus1 > 0){
								that.vehicleStext = '待审核';
								that.vehicleFlag = true
								that.vehicledesc = ''
								that.vehicletTips = `审核方:${that.etpName}`
							} 
							 else {
								// (对的)
								that.vehicleStext = '已认证';
								that.vehicleFlag = true
								that.vehicledesc = ''
								that.vehicletTips = ''
							}
							break;
						case '2':
							 if (res.data.data.vehicleEtpSize > 0) {
								that.vehicleStext = '申诉中';
								that.vehicleFlag = true
								that.vehicledesc = ''
								that.vehicletTips = '审核方:运必达平台'
							} else if (res.data.data.vehicleEtpStatus3 > 0) {
								if (res.data.data.vehicleEtpSize > 0) {
									that.vehicleStext = '申诉中';
									that.vehicleFlag = true
									that.vehicledesc = ''
									that.vehicletTips = '审核方:运必达平台'
								} else if(res.data.datavehicleEtpStatus32 > 0){
									that.vehicleStext = '审核驳回';
									that.vehicleFlag = false
									that.vehicledesc = '车辆审核驳回'
									that.vehicletTips = `审核方:${that.etpName}`	
								}  else {
									that.vehicleStext = '审核驳回';
									that.vehicleFlag = false
									that.vehicledesc = '车辆审核驳回'
									that.vehicletTips = `审核方:${that.etpName}`
								}
							}else if (res.data.data.vehicleEtpStatus32 > 0) {
								that.vehicleStext = '审核驳回';
								that.vehicleFlag = false
								that.vehicledesc = '车辆审核驳回'
								that.vehicletTips = `审核方:${that.etpName}`	
							
							}else if(res.data.data.vehicleEtpStatus1 > 0){
								that.vehicleStext = '待审核';
								that.vehicleFlag = true
								that.vehicledesc = ''
								that.vehicletTips = `审核方:${that.etpName}`
							} else {
								that.vehicleStext = '已过期';
								that.vehicleFlag = false
								that.vehicledesc = '车辆证件已过期'
								that.vehicletTips = '证件已过期:请及时更新'
							}
							break;
					}
					if(this.realNameStext == '待认证'){
						this.commonDesc = '，不可接单'
						console.log('不可接单')
					}
					if (this.realNameStext == '待审核' || this.vehicleStext == '待审核') {
						this.commonDesc = '，不可接单'
					}
					if (this.realNameStext == '未认证' || this.vehicleStext == '未认证') {
						this.commonDesc = '，不可接单'
					}
					if (this.realNameStext == '已过期' || this.vehicleStext == '已过期') {
						this.commonDesc = '，不可接单'
					}
					if (this.realNameStext == '申诉驳回' || this.vehicleStext == '申诉驳回') {
						this.commonDesc = '，请点击修改'
					}

					switch (
						that.signStatus //签约状态
					) {
						case '0':
							that.signStext = '未认证';
							break;
						case '1':
							// if (that.flagindex != -1) {
							// 	that.flagindex = 1;
							// }
							that.signStext = '已认证';
							break;
						case '2':
							that.signStext = '已过期';
							break;
					}
					switch (
						that.realMobileStatus //实名认证状态
					) {
						case '0':
							that.realMobileStext = '未认证';
							break;
						case '1':
							// if (that.flagindex != -1) {
							// 	that.flagindex = 1;
							// }
							that.realMobileStext = '已认证';
							break;
						case '2':
							that.realMobileStext = '已过期';
							break;
					}
					that.$refs.popup4.open('center');
					console.log(that.realNameStext, that.vehicleStext,'是否更新了')
				}

				// let that = this;
				// that.wxRequest({
				// 	url: `${that.API}/driverService/checkQualifications`,
				// 	method: 'POST',
				// 	data: {
				// 		driverId: uni.getStorageSync(that.DATA_KEY.userInfo).driverId,
				// 		etpId: uni.getStorageSync(that.DATA_KEY.etpId)
				// 	},
				// 	success: res => {
				//		uni.setStorageSync(this.DATA_KEY.platformCoNo, res.data.data.platformCoNo);
				// 		console.log('ddddd=======================>0', !res.data.data.flag);
				// 		if (!res.data.data.flag) {
				// 			that.realNameStatus = res.data.data.realNameStatus;
				// 			that.vehicleStatus = res.data.data.vehicleStatus;
				// 			switch (
				// 				that.realNameStatus //实名状态
				// 			) {
				// 				case '0':
				// 					that.flagindex = -1;
				// 					that.realNameStext = '未实名';
				// 					break;
				// 				case '1':
				// 					that.flagindex = 0;
				// 					that.realNameStext = '已实名';
				// 					break;
				// 				case '2':
				// 					that.flagindex = -1;
				// 					that.realNameStext = '已过期';
				// 					break;
				// 			}
				// 			switch (
				// 				that.vehicleStatus //车辆认证状态
				// 			) {
				// 				case '0':
				// 					that.vehicleStext = '未认证';
				// 					break;
				// 				case '1':
				// 					if (that.flagindex != -1) {
				// 						that.flagindex = 1;
				// 					}
				// 					that.vehicleStext = '已认证';
				// 					break;
				// 				case '2':
				// 					that.vehicleStext = '已过期';
				// 					break;
				// 			}
				// 			that.$refs.popup4.open('center');
				// 		}
				// 	}
				// });
			},
			//驳回作废3 确认作废4
			operateLoadingOrder(val,item){
				let that = this
				uni.showModal({
					title: '提示',
					content: val==3?'将驳回当前作废申请，确认吗?':'将作废当前配载单，确认吗?',
					success: function(res) {
						if (res.confirm) {
							that.wxRequest({
								url: `${that.API}/new/loadingOrder/operateLoadingOrder?loadingOrderId=${item.loadingOrderId}&operate=${val}&driverId=${that.userInfo.driverId}`,
								method: 'POST',
								data: {
									"loadingOrderId": item.loadingOrderId,
									"operate": val,
									"driverId": that.userInfo.driverId
								},
								success: res => {
									uni.showToast({
										title: '操作成功',
										icon: 'none'
									});
									that.onwaybill();
									if (val == 4) {
										gps.stopLocationUpdate(item)
									}
									that.getMessage()
								}
							})
						} else if (res.cancel) {
							console.log('取消');
						}
					}
				});
			},
			async LunLocation() {
				let loc = null
				let info = []
				for (var i = 0; i < 5; i++) {
					const delayTime = 2000
					loc = await this.loctionFn()
					// this.locationLog({
					// 	content: 'getLocation轮询第'+ i +'次' + JSON.stringify(loc)
					// })
					let result = `轨迹轮询第[${i+1}]次${loc.type}，${JSON.stringify(loc)}`
					info.push(result)
					console.log(loc)
					if (loc.type == '成功') {
						this.locationLog({
							content: JSON.stringify(info)
						})
						return loc
					}
					await helper.sleep(delayTime)
				}
				this.locationLog({
					content: JSON.stringify(info)
				})
				return loc.type == '成功' ? loc : false
			},
			loctionFn() {
				return new Promise((resolve, reject) => {
					uni.getLocation({
						type: 'wgs84',
						success: (res) => {
							// if (res.longitude && res.latitude) {
							// 	resolve({longitude: res.longitude, latitude: res.latitude})
							// } else {
							// 	resolve(false)
							// }
							resolve({type: '成功', longitude: res.longitude, latitude: res.latitude})
						},
						fail: (err) => {
							console.log('轮询获取位置信息失败')
							resolve({type: '失败', ...err})
						}
					})
				})
			},
			checkSystemLocation() {
				return new Promise((resolve, reject) => {
					let that = this
					// 1、判断手机定位服务【GPS】 是否授权
					uni.getSystemInfo({
						success(res) {
							console.log(res)
							console.log("0000000000000000000000000")
							if (!res.locationEnabled) {
								resolve(false)
								//手机定位服务（GPS）未授权
								uni.showModal({
									title: '提示',
									content: '请开启手机gps定位,设置-隐私-位置',
									showCancel: false, // 不显示取消按钮
									success() {
										
									}
								})
							} else {
								resolve(true)
							}
						}
					})
								
				})
			},
			checkLocationBackgrounnd() {
				return new Promise((resolve, reject) => {
					uni.getSetting({
						success: res => {
								if (!res.authSetting[
										`scope.userLocationBackground`]) { //用户未请求过此权限，后者用户拒绝了此权限
									uni.authorize({ //如果没请求过，会弹窗询问。同意过，直接success。此前拒绝，直接fai
										scope: `scope.userLocationBackground`,
										success: res => { //用户同意
											console.log(
												`%c用户同意位置信息权限1`,
												'color:green;background:yellow');
											resolve(true)
										},
										fail: err => { //用户拒绝
											console.log(
												`%c用户拒绝位置信息权限`,
												'color:green;background:yellow');
											uni.showModal({
												title: '司机小程序"需要获取您的当前位置',
												content: `请点击设置->打开位置信息->使用小程序期间和离开小程序后`,
												success: res => {
													if (res.confirm) {
														uni.openSetting({
															success: (dataAu) => {
																if (dataAu.authSetting["scope.userLocationBackground"] == true) {
																	//再次授权，调用getLocation的API
																	console.log(`%cuni.openSetting成功：`, 'color:green;background:yellow')
																	resolve(true)
																} else {
																	console.log(`%cuni.openSetting失败：`, 'color:green;background:yellow');
																	resolve(false)
																}
															}
														})
													}
												},
												fail: err => {
													console.log(`%cuni.showModal失败：`, 'color:green;background:yellow');
												}
											})
										}
									})
								} else { //用户同意授权此权限，直接调用接口
									console.log(`%c用户同意位置信息权限2`,
										'color:green;background:yellow');
									resolve(true)
								}
						},
						fail: err => {
							console.log(`%cuni.getSetting失败：`, 'color:green;background:yellow');
							console.log(err);
						}
					})
				})
			},
			async LunGuiji() {
				while (true) {
					const delayTime = 3600000; //轮询间隔时间一小时
					try {
						let currentTime = new Date().getTime();
						let oldTime = uni.getStorageSync(this.DATA_KEY.oldTime);
						console.log('起运  时间 while', currentTime,
							oldTime, currentTime -
							oldTime > 600000);
						if (currentTime - oldTime > 600000) { // 上次轨迹上传时间超过10分钟
							let that = this
							that.wxRequest({
								url: `${that.API}/miniApp/loadingOrder/driverLoadingOrderPage`,
								method: 'POST',
								data: {
									pageNo: 1,
									pageSize: 10,
									etpId: that.etpId,
									queryType: 1,
									// tel: uni.getStorageSync(that.DATA_KEY.userInfo).mobile
								},
								success: async res => {
									that.tasklist = res.data.data.list
									await that.guijiChangeFn()
								}
							})
							// await this.guijiChangeFn()
						}
						await helper.sleep(delayTime)
					} catch (e) {
						await helper.sleep(delayTime)
					}
				}
			},
			guijiChangeFn() {
				return new Promise((resolve, reject) => {
					// #ifdef MP-WEIXIN
					
						console.log(uni.getStorageSync('__isExitFlag__'), '22222222222')
						let list = this.tasklist.filter(item => item.shippingStatus == 2)
						if (list.length && list[0].shippingStatus == 2) {
							//启动定位
							console.log('onload', '11111111111')
							let taskvalue = list[0]
							let that = this
					
							this.wxRequest({
								url: `${that.API}/fance/waybillFence/createCircleFenceIsSuccess?waybillId=${taskvalue.waybillId}`,
								method: 'get',
								title: '加载中...',
								success: async res => {
									if (res.data.data && res.data.data.fenceStatus == 1) {
										uni.setStorageSync(that.DATA_KEY.loadingOrderId, taskvalue
											.loadingOrderId);
										let Trajectory = [];
										uni.setStorageSync('Trajectory', Trajectory);
										await that.stopLocationUpdate()
										wx.startLocationUpdateBackground({
											success: res => {
												wx.onLocationChange(data => {
													var currentTime = new Date().getTime();
													var oldTime = uni.getStorageSync(that
														.DATA_KEY.oldTime);
													console.log('起运  时间 ', currentTime,
														oldTime, currentTime -
														oldTime > 180000);
													if (currentTime - oldTime > 180000) {
														uni.setStorageSync(that.DATA_KEY
															.oldTime, currentTime);
					
														that.wxRequest({
															url: `${that.API}/fance/waybillFence/cronJsFance`,
															method: 'POST',
															data: {
																vehicleNo: taskvalue
																	.vehicleNo,
																driverTel: uni
																	.getStorageSync(
																		that
																		.DATA_KEY
																		.userInfo)
																	.mobile,
																trackType: 2,
																driverId: uni
																	.getStorageSync(
																		that
																		.DATA_KEY
																		.userInfo)
																	.driverId,
																loadingOrderId: uni
																	.getStorageSync(
																		that
																		.DATA_KEY
																		.loadingOrderId
																		),
																lat: data.latitude,
																lng: data.longitude
															},
															success: res => {
																console.log(
																	res)
																	resolve(res)
															}
														});
					
														let Trajectory = [];
														console.log('轨迹点0   ', uni
															.getStorageSync(
																'Trajectory'));
														console.log('轨迹点1   ', !uni
															.getStorageSync(
																'Trajectory'));
														if (uni.getStorageSync(
																'Trajectory').length ==
															0) {
															Trajectory = [];
														} else {
															Trajectory = uni
																.getStorageSync(
																	'Trajectory');
														}
														console.log('运单号0   ', uni
															.getStorageSync(that
																.DATA_KEY
																.loadingOrderId) != '');
														let Trajectoryinfo = {
															lat: data.latitude,
															lng: data.longitude,
															positionTime: currentTime
														};
														Trajectory.push(Trajectoryinfo);
														uni.setStorageSync('Trajectory',
															Trajectory);
														console.log('轨迹数据 ', uni
															.getStorageSync(
																'Trajectory'));
														/* that.wxRequest({
															url: `${that.API}/driverService/uploadMinilocus`,
															method: 'POST',
															data: {
																trackType: 2,
																loadingOrderId: uni.getStorageSync(that.DATA_KEY.loadingOrderId),
																list: Trajectory,
																vehicleNo: taskvalue.vehicleNo,
																driverTel: uni.getStorageSync(that.DATA_KEY.userInfo).mobile
															},
															success: res => {
																Trajectory = [];
																uni.setStorageSync('Trajectory', Trajectory);
															}
														}); */
													} else {
														resolve(false)
													}
												});
											},
											fail: res => {
												console.log('获取位置失败', res);
												reject()
											}
										});
									} else {
										uni.setStorageSync(that.DATA_KEY.loadingOrderId, taskvalue
											.loadingOrderId);
										let Trajectory = [];
										uni.setStorageSync('Trajectory', Trajectory);
										await that.stopLocationUpdate()
										wx.startLocationUpdateBackground({
											success: res => {
												wx.onLocationChange(data => {
													var currentTime = new Date().getTime();
													var oldTime = uni.getStorageSync(that
														.DATA_KEY.oldTime);
													console.log('起运  时间 ', currentTime,
														oldTime, currentTime -
														oldTime > 180000);
													if (currentTime - oldTime > 180000) {
														uni.setStorageSync(that.DATA_KEY
															.oldTime, currentTime);
														let Trajectory = [];
														console.log('轨迹点0   ', uni
															.getStorageSync(
																'Trajectory'));
														console.log('轨迹点1   ', !uni
															.getStorageSync(
																'Trajectory'));
														if (uni.getStorageSync(
																'Trajectory').length ==
															0) {
															Trajectory = [];
														} else {
															Trajectory = uni
																.getStorageSync(
																	'Trajectory');
														}
														console.log('运单号0   ', uni
															.getStorageSync(that
																.DATA_KEY
																.loadingOrderId) != '');
														let Trajectoryinfo = {
															lat: data.latitude,
															lng: data.longitude,
															positionTime: currentTime
														};
														Trajectory.push(Trajectoryinfo);
														uni.setStorageSync('Trajectory',
															Trajectory);
														console.log('轨迹数据 ', uni
															.getStorageSync(
																'Trajectory'));
														that.wxRequest({
															url: `${that.API}/driverService/uploadMinilocus`,
															method: 'POST',
															data: {
																trackType: 2,
																loadingOrderId: uni
																	.getStorageSync(
																		that
																		.DATA_KEY
																		.loadingOrderId
																		),
																list: Trajectory,
																vehicleNo: taskvalue
																	.vehicleNo,
																driverTel: uni
																	.getStorageSync(
																		that
																		.DATA_KEY
																		.userInfo)
																	.mobile
															},
															success: res => {
																Trajectory
															= [];
																uni.setStorageSync(
																	'Trajectory',
																	Trajectory
																	);
																resolve(res)
															}
														});
													} else {
														resolve(false)
													}
												});
											},
											fail: res => {
												console.log('获取位置失败', res);
												reject()
											}
										});
									}
								}
							})
						}
						let list2 = this.tasklist.filter(item => item.shippingStatus == 1)
						// console.log(list2[0].shippingStatus,'============')
						if (list2.length && list2[0].shippingStatus == 1) {
							let taskvalue = list2[0]
							console.log(taskvalue,'============')
							let that = this
							this.wxRequest({
								url: `${that.API}/fance/waybillFence/createCircleFenceIsSuccess?waybillId=${taskvalue.waybillId}`,
								method: 'get',
								title: '加载中...',
								success: async res => {
									if (res.data.data && res.data.data.fenceStatus == 1) {
										uni.setStorageSync(that.DATA_KEY.loadingOrderId, taskvalue
											.loadingOrderId);
										await that.stopLocationUpdate()
										wx.startLocationUpdateBackground({
											success: res => {
												wx.onLocationChange(data => {
													var currentTime = new Date().getTime();
													var oldTime = uni.getStorageSync(that
														.DATA_KEY.oldTime);
													console.log('起运  时间 ', currentTime,
														oldTime, currentTime -
														oldTime > 180000);
													if (currentTime - oldTime > 180000) {
														uni.setStorageSync(that.DATA_KEY
															.oldTime, currentTime);
					
														that.wxRequest({
															url: `${that.API}/fance/waybillFence/cronJsFance`,
															method: 'POST',
															data: {
																vehicleNo: taskvalue
																	.vehicleNo,
																driverTel: uni
																	.getStorageSync(
																		that
																		.DATA_KEY
																		.userInfo)
																	.mobile,
																trackType: 2,
																driverId: uni
																	.getStorageSync(
																		that
																		.DATA_KEY
																		.userInfo)
																	.driverId,
																loadingOrderId: uni
																	.getStorageSync(
																		that
																		.DATA_KEY
																		.loadingOrderId
																		),
																lat: data.latitude,
																lng: data.longitude
															},
															success: res => {
																console.log(
																	res)
																	resolve(res)
															}
														});
													} else {
														resolve(false)
													}
												});
											},
											fail: res => {
												console.log('获取位置失败', res);
												reject()
											}
										});
									} else {
										resolve(false)
									}
								}
							})
						}
					// #endif
					// #ifdef APP
					let list = this.tasklist.filter(item => item.shippingStatus == 2)
					if (list.length && list[0].shippingStatus == 2) {
						if (this.Interval) {
							console.log(this.Interval, 777777777)
							return
						}
						let that = this
						let taskvalue = list[0]
						that.Interval = setInterval(() => {
							//app测试是否调用上传地理位置问题使用
							// 调用异步方法启动定位
							console.log('d======================调用异步方法启动定位 ');
							locationModule.start({
									appSecurity: taskvalue.appSecurity,
									enterpriseSenderCode: taskvalue.enterpriseSenderCode,
									ShippingNoteNumber: taskvalue.loadingOrderId,
									StartCountrySubdivisionCode: taskvalue.shippingRegionCode,
									EndCountrySubdivisionCode: taskvalue.receiptRegionCode,
									StartLongitude: taskvalue.StartLongitude,
									StartLatitude: taskvalue.StartLatitude,
									EndLongitude: taskvalue.EndLongitude,
									EndLatitude: taskvalue.EndLatitude,
									StartLocationText: taskvalue.shippingCity,
									EndLocationText: taskvalue.receiptCity,
									VehicleNumber: taskvalue.vehicleNo,
									DriverName: taskvalue.driverName
								},
								ret => {
									let rets = ret.code;
									uni.getLocation({
										type: 'wgs84',
										success: function(res) {
											let longitude = res.longitude;
											let latitude = res.latitude;
											if (rets == '发送定位send成功') {
												uni.setStorageSync('loadingOrderId', taskvalue
													.loadingOrderId);
												//发送定位回调
												uni.request({
													url: `https://sign.y2t.com/tax/taxInfoUpload`,
													method: 'POST',
													data: {
														vehicleNumber: taskvalue
															.vehicleNo,
														driverName: taskvalue
															.driverName,
														shippingNoteNumber: taskvalue
															.loadingOrderId,
														longitude: longitude,
														latitude: latitude,
														status: 1
													},
													success: res => {
														uni.hideLoading();
														console.log('发送定位回调结果',
															res);
														resolve(res)
													},
													fail: error => {
														uni.hideLoading();
														uni.showToast({
															title: '网络异常！',
															icon: 'none'
														});
													},
													complete: res => {
														if (obj.complete) obj
															.complete(res);
													}
												});
												console.log(
													'====================================',
													taskvalue.loadingOrderId);
											}
										}
									});
									console.log('发送定位结果', ret.code);
									// uni.showModal({
									// 	title: '提示',
									// 	content: ret.code,
									// 	showCancel: false,
									// 	success: function(res) {
									// 		if (res.confirm) {
									// 			console.log('用户点击确定');
									// 		}
									// 	}
									// });
								}
							);
							//上传坐标点
							uni.getLocation({
								type: 'wgs84',
								success: (res) => {
									let currentTime = new Date().getTime();
									let Trajectory = []
									let Trajectoryinfo = {
										lat: res.latitude,
										lng: res.longitude,
										positionTime: currentTime
									};
									Trajectory.push(Trajectoryinfo);
									uni.setStorageSync('Trajectory', Trajectory);
									that.wxRequest({
										url: `${that.API}/driverService/uploadMinilocus`, //每3分钟上传定位：经纬度、车辆、司机手机号接口
										method: 'POST',
										data: {
											trackType: 3,
											loadingOrderId: taskvalue.loadingOrderId,
											list: Trajectory,
											vehicleNo: taskvalue.vehicleNo,
											driverTel: uni.getStorageSync(that.DATA_KEY
												.userInfo).mobile
										},
										success: res => {
											//app测试是否调用上传地理位置问题使用
											// uni.showModal({
											// 	title: `${taskvalue.loadingOrderId}上传坐标点0002`+JSON.stringify(res.data)
											// })
											Trajectory = [];
											uni.setStorageSync('Trajectory',Trajectory);
											resolve(res)
										}
									});
								}
							})
						}, 180000);  //3分钟调一次
					}
					// #endif
				})
			},
			
			locationLog(data) {
				this.wxRequest({
					url: `${this.API}/miniApp/loadingOrder/saveTrajectoryLog`,
					method: 'POST',
					data: {
						loadingOrderId: this.orderloadingOrderId,
						driverId: uni.getStorageSync(this.DATA_KEY.userInfo).driverId,
						content: JSON.stringify({
							platform: uni.getSystemInfoSync().platform,
							// #ifdef MP-WEIXIN
							wxVersion: wx.getAppBaseInfo().SDKVersion,
							// #endif
							title: this.CheckinNodeName,
							result: data.content
						})
					},
					success: res => {
						
					}
				})
			},
			stopLocationUpdate() {
				return new Promise((resolve, reject) => {
					wx.stopLocationUpdate({
						complete: () => {
							resolve()
						}
					})
				})
			},
			// 上传轨迹点
			guijiUpload1(taskvalue, status) {
				let that = this
				// if (!this.test) {
				uni.getLocation({
					type: 'wgs84',
					success: function(
						res
						) {
						let longitude =
							res
							.longitude;
						let latitude =
							res
							.latitude;
							uni.setStorageSync(
								'loadingOrderId',
								taskvalue
								.loadingOrderId
								);
							//发送定位回调
							uni.request({
								url: `https://sign.y2t.com/tax/taxInfoUpload`,
								method: 'POST',
								data: {
									vehicleNumber: taskvalue
										.vehicleNo,
									driverName: taskvalue
										.driverName,
									shippingNoteNumber: taskvalue
										.loadingOrderId,
									longitude: longitude,
									latitude: latitude,
									status: status
								},
								success: res => {
									uni
								.hideLoading();
									console
										.log(
											'发送定位回调结果',
											res
											);
								},
								fail: error => {
									uni
								.hideLoading();
									uni.showToast({
										title: '网络异常！',
										icon: 'none'
									});
								},
								complete: res => {
									if (obj
										.complete
										)
										obj
										.complete(
											res
											);
								}
							});
							console
								.log(
									'====================================',
									taskvalue
									.loadingOrderId
									);
						
						//上传坐标点
						let currentTime =
							new Date()
							.getTime();
						let Trajectory = []
						let Trajectoryinfo = {
							lat: latitude,
							lng: longitude,
							positionTime: currentTime
						};
						Trajectory
							.push(
								Trajectoryinfo
								);
						uni.setStorageSync(
							'Trajectory',
							Trajectory
							);
						that.locationLog({
							content: (status == 1 ? '起运' : '到达') + '调用上传接口'
						})
						that.wxRequest({
							url: `${that.API}/fance/waybillFence/cronJsFance`,
							method: 'POST',
							data: {
								vehicleNo: taskvalue
									.vehicleNo,
								driverTel: uni
									.getStorageSync(
										that
										.DATA_KEY
										.userInfo
										)
									.mobile,
								trackType: 3,
								driverId: uni
									.getStorageSync(
										that
										.DATA_KEY
										.userInfo
										)
									.driverId,
								loadingOrderId: taskvalue
									.loadingOrderId,
								lat: latitude,
								lng: longitude
							},
							success: res => {
								console
									.log(
										res
										)
							}
						});
					},
					fail: async (
						err) => {
						// uni.showToast({
						// 	title: "位置定位失败，请查看定位权限是否开启",
						// 	icon: "none"
						// })
						if (status == 1) {
							that.locationLog({
								content: '起运位置开启失败' + JSON.stringify(res)
							})
						} else {
							that.locationLog({
								content: '到达getLocation失败，' + JSON.stringify(res) 
							})
						}
						let loc = await that.LunLocation()
						if (loc) {
							that.wxRequest({
								url: `${that.API}/fance/waybillFence/cronJsFance`,
								method: 'POST',
								data: {
									vehicleNo: taskvalue
										.vehicleNo, //车牌号
									driverTel: uni
										.getStorageSync(
											that
											.DATA_KEY
											.userInfo
											)
										.mobile, //手机号
									trackType: 3,
									driverId: uni
										.getStorageSync(
											that
											.DATA_KEY
											.userInfo
											)
										.driverId,
									loadingOrderId: uni
										.getStorageSync(
											that
											.DATA_KEY
											.loadingOrderId
											),
									lat: loc
										.latitude,
									lng: loc
										.longitude
								},
								success: res => {
									// that.locationLog({
									// 	content: '起运调用uploadMinilocus成功'+ JSON.stringify(res.data) 
									// })
									console
										.log(
											res
											)
								}
							});
						}
						console
							.log(
								'获取位置失败',
								res
								);
					}
				});
				// } else {
				// let res = {}
				// if (status == 1) {
				// 	that.locationLog({
				// 		content: '起运位置开启失败' + JSON.stringify(res)
				// 	})
				// } else {
				// 	that.locationLog({
				// 		content: '到达getLocation失败，' + JSON.stringify(res) 
				// 	})
				// }
				// let loc = await that.LunLocation()
				// if (loc) {
				// 	that.wxRequest({
				// 		url: `${that.API}/fance/waybillFence/cronJsFance`,
				// 		method: 'POST',
				// 		data: {
				// 			vehicleNo: taskvalue
				// 				.vehicleNo, //车牌号
				// 			driverTel: uni
				// 				.getStorageSync(
				// 					that
				// 					.DATA_KEY
				// 					.userInfo
				// 					)
				// 				.mobile, //手机号
				// 			trackType: 3,
				// 			driverId: uni
				// 				.getStorageSync(
				// 					that
				// 					.DATA_KEY
				// 					.userInfo
				// 					)
				// 				.driverId,
				// 			loadingOrderId: uni
				// 				.getStorageSync(
				// 					that
				// 					.DATA_KEY
				// 					.loadingOrderId
				// 					),
				// 			lat: loc
				// 				.latitude,
				// 			lng: loc
				// 				.longitude
				// 		},
				// 		success: res => {
				// 			// that.locationLog({
				// 			// 	content: '起运调用uploadMinilocus成功'+ JSON.stringify(res.data) 
				// 			// })
				// 			console
				// 				.log(
				// 					res
				// 					)
				// 		}
				// 	});
				// }
				// }
			},
			guijiUpload2(taskvalue, status) {
				let that = this
				// if (!this.test) {
				uni.getLocation({
					type: 'wgs84',
					success: function(res) {
						let longitude = res.longitude;
						let latitude = res.latitude;
							uni.setStorageSync(
								'loadingOrderId',
								taskvalue
								.loadingOrderId);
							//发送定位回调
							uni.request({
								url: `https://sign.y2t.com/tax/taxInfoUpload`,
								method: 'POST',
								data: {
									vehicleNumber: taskvalue
										.vehicleNo,
									driverName: taskvalue
										.driverName,
									shippingNoteNumber: taskvalue
										.loadingOrderId,
									longitude: longitude,
									latitude: latitude,
									status: status
								},
								success: res => {
									uni
								.hideLoading();
									console
										.log(
											'发送定位回调结果',
											res
											);
								},
								fail: error => {
									uni
								.hideLoading();
									uni.showToast({
										title: '网络异常！',
										icon: 'none'
									});
								},
								complete: res => {
									if (obj
										.complete
										)
										obj
										.complete(
											res
											);
								}
							});
							console.log(
								'====================================',
								taskvalue
								.loadingOrderId);
						
						//上传坐标点
						let currentTime = new Date()
							.getTime();
						let Trajectory = []
						let Trajectoryinfo = {
							lat: latitude,
							lng: longitude,
							positionTime: currentTime
						};
						Trajectory.push(
						Trajectoryinfo);
						uni.setStorageSync(
							'Trajectory',
							Trajectory);
						that.locationLog({
							content: (status == 1 ? '起运' : '到达') + '调用上传接口'
						})
						that.wxRequest({
							url: `${that.API}/driverService/uploadMinilocus`,
							method: 'POST',
							data: {
								trackType: 3,
								loadingOrderId: taskvalue
									.loadingOrderId,
								list: Trajectory,
								vehicleNo: taskvalue
									.vehicleNo,
								driverTel: uni
									.getStorageSync(
										that
										.DATA_KEY
										.userInfo
										)
									.mobile
							},
							success: res => {
								console
									.log(
										'上传坐标点成功',
										res
										)
								Trajectory
									= [];
								uni.setStorageSync(
									'Trajectory',
									Trajectory
									);
							},
							fail: error => {
								console
									.log(
										'上传坐标点失败'
										)
								Trajectory
									= [];
								uni.setStorageSync(
									'Trajectory',
									Trajectory
									);
							},
						});
					},
					fail: async (err) => {
						// uni.showToast({
						// 	title: "位置定位失败，请查看定位权限是否开启",
						// 	icon: "none"
						// })
						if (status == 1) {
							that.locationLog({
								content: '起运位置开启失败' + JSON.stringify(res)
							})
						} else {
							that.locationLog({
								content: '到达getLocation失败，' + JSON.stringify(res) 
							})
						}
						let loc = await that.LunLocation()
						if (loc) {
							let currentTime =
								new Date()
								.getTime();
							let Trajectory = []
							let Trajectoryinfo = {
								lat: loc
									.latitude,
								lng: loc
									.longitude,
								positionTime: currentTime
							};
							Trajectory
								.push(
									Trajectoryinfo
									);
							that.wxRequest({
								url: `${that.API}/driverService/uploadMinilocus`,
								method: 'POST',
								data: {
									trackType: 3,
									loadingOrderId: uni
										.getStorageSync(
											that
											.DATA_KEY
											.loadingOrderId
											),
									list: Trajectory,
									vehicleNo: taskvalue
										.vehicleNo,
									driverTel: uni
										.getStorageSync(
											that
											.DATA_KEY
											.userInfo
											)
										.mobile
								},
								success: res => {
									Trajectory
										= [];
									// that.locationLog({
									// 	content: '起运调用uploadMinilocus成功'+ JSON.stringify(res.data) 
									// })
									uni.setStorageSync(
										'Trajectory',
										Trajectory
										);
								}
							});
						}
						
						console
							.log(
								'获取位置失败',
								res
								);
					}
				});
				// } else {
				// 	let res = {}
				// 	if (status == 1) {
				// 		that.locationLog({
				// 			content: '起运位置开启失败' + JSON.stringify(res)
				// 		})
				// 	} else {
				// 		that.locationLog({
				// 			content: '到达getLocation失败，' + JSON.stringify(res) 
				// 		})
				// 	}
				// 	let loc = await that.LunLocation()
				// 	if (loc) {
				// 		let currentTime =
				// 			new Date()
				// 			.getTime();
				// 		let Trajectory = []
				// 		let Trajectoryinfo = {
				// 			lat: loc
				// 				.latitude,
				// 			lng: loc
				// 				.longitude,
				// 			positionTime: currentTime
				// 		};
				// 		Trajectory
				// 			.push(
				// 				Trajectoryinfo
				// 				);
				// 		that.wxRequest({
				// 			url: `${that.API}/driverService/uploadMinilocus`,
				// 			method: 'POST',
				// 			data: {
				// 				trackType: 3,
				// 				loadingOrderId: uni
				// 					.getStorageSync(
				// 						that
				// 						.DATA_KEY
				// 						.loadingOrderId
				// 						),
				// 				list: Trajectory,
				// 				vehicleNo: taskvalue
				// 					.vehicleNo,
				// 				driverTel: uni
				// 					.getStorageSync(
				// 						that
				// 						.DATA_KEY
				// 						.userInfo
				// 						)
				// 					.mobile
				// 			},
				// 			success: res => {
				// 				Trajectory
				// 					= [];
				// 				// that.locationLog({
				// 				// 	content: '起运调用uploadMinilocus成功'+ JSON.stringify(res.data) 
				// 				// })
				// 				uni.setStorageSync(
				// 					'Trajectory',
				// 					Trajectory
				// 					);
				// 			}
				// 		});
				// 	}
				// }
			},
			// 接单
			receive() {
				return new Promise((resolve, reject) => {
					const that = this
					that.wxRequest({
						url: `${that.API}/miniApp/loadingOrder/receive`,
						method: 'POST',
						data: {
							// #ifdef MP-WEIXIN
							clickLocation: 3,
							// #endif
							// #ifdef APP-PLUS
							clickLocation: 1,
							// #endif
							loadingOrderId: that.scanloadingOrderId,
						},
						title: '接单中...',
						success: res => {
							uni.showToast({
								title: '抢单成功！',
								icon: 'none'
							});
							that.$refs.popup5.close();
							resolve()
							that.page = 1;
							that.onwaybill(that.mescroll);
						},
						fail: err => {
							reject(err)
						}
					})
				})
			},
			// 轨迹重连
			connectGuiji() {
				let that = this
				that.wxRequest({
					url: `${that.API}/miniApp/loadingOrder/driverLoadingOrderPage`,
					method: 'POST',
					data: {
						pageNo: 1,
						pageSize: 1,
						etpId: that.etpId,
						queryType: 1,
						// tel: uni.getStorageSync(that.DATA_KEY.userInfo).mobile
					},
					success: async res => {
						let list = res.data.data.list
						let item = list[0]
						if (list.length && list[0].shippingStatus == 2) {
							let currentTime = new Date().getTime()
							let oldTime = uni.getStorageSync('gpsUploadTime')
							console.log(currentTime - oldTime)
							if (currentTime - oldTime > 240000) { // 距离上次上传时间间隔超过4分钟240000
							let fenceData = await that.createCircleFenceIsSuccess(item)
								if (fenceData && fenceData.data.fenceStatus == 1) {
									gps.startLoctionBackgroundUpdate(item, that.cronJsFance)
								} else {
									gps.startLoctionBackgroundUpdate(item, that.uploadMinilocus)
								}
							}
						}
						if (list.length && list[0].shippingStatus == 1) {
							let fenceData = await that.createCircleFenceIsSuccess(item)
							if (fenceData && fenceData.data.fenceStatus == 1) {
								await gps.startLoctionBackgroundUpdate(item, that.cronJsFance)
							}
						}
					}
				})
			},
			createCircleFenceIsSuccess(taskvalue) {
				return new Promise((resolve, reject) => {
					let that = this
					that.wxRequest({
						url: `${that.API}/fance/waybillFence/createCircleFenceIsSuccess?waybillId=${taskvalue.waybillId}`,
						method: 'get',
						title: '加载中...',
						success: res => {
							resolve(res.data)
						},
						fail: err => {
							reject(err)
						}
					})
				})
			},
			cronJsFance(taskvalue, res){
				let that = this
				console.log(that)
				that.wxRequest({
					url: `${that.API}/fance/waybillFence/cronJsFance`,
					method: 'POST',
					data: {
						vehicleNo: taskvalue.vehicleNo,
						driverTel: uni.getStorageSync(that.DATA_KEY.userInfo).mobile,
						trackType: 2,
						driverId: uni.getStorageSync(that.DATA_KEY.userInfo).driverId,
						loadingOrderId: taskvalue.loadingOrderId,
						lat: res.latitude,
						lng: res.longitude
					},
					complete: res => {
						console.log(res)
						if (res.data && res.data.code == 0) {
							if (uni.getStorageSync('gpsUploadTime') == 0) {
								that.logFn(`上传成功cronJsFance`)
							}
							uni.setStorageSync('gpsUploadTime', new Date().getTime())
						} else {
							if (uni.getStorageSync('gpsUploadTime') == 0) {
								that.logFn(`上传失败cronJsFance，${(res.data && res.data.msg) ? res.data.msg : ''}`)
							}
							uni.setStorageSync('gpsUploadTime', 0)
							if (res.data && res.data.msg == '起运到达时间间隔太短，无法到达') {
								that.page = 1
								that.onwaybill(that.mescroll)
							} 
						}
						if (res.data.data && (res.data.data == 1 || res.data.data == 2)) {
							that.page = 1
							that.onwaybill(that.mescroll)
						}
					},
					success: res => {
						
					}
				})
				that.taxInfoUpload(taskvalue, res)
			},
			uploadMinilocus(taskvalue, res){
				let Trajectory = [];
				let currentTime = new Date().getTime()
				let Trajectoryinfo = {
					lat: res.latitude,
					lng: res.longitude,
					positionTime: currentTime
				};
				Trajectory.push(Trajectoryinfo);
				let that = this
				that.wxRequest({
					url: `${that.API}/driverService/uploadMinilocus`,
					method: 'POST',
					data: {
						trackType: 2,
						loadingOrderId: taskvalue.loadingOrderId,
						list: Trajectory,
						
						vehicleNo: taskvalue.vehicleNo,
						driverTel: uni.getStorageSync(that.DATA_KEY.userInfo).mobile
					},
					complete: res => {
						console.log(res)
						if (res.data && res.data.code == 0) {
							if (uni.getStorageSync('gpsUploadTime') == 0) {
								that.logFn(`上传成功uploadMinilocus`)
							}
							uni.setStorageSync('gpsUploadTime', new Date().getTime())
						} else {
							if (uni.getStorageSync('gpsUploadTime') == 0) {
								that.logFn(`上传失败uploadMinilocus，${(res.data && res.data.msg) ? res.data.msg : ''}`)
								uni.setStorageSync('gpsUploadTime', new Date().getTime())
							}
							uni.setStorageSync('gpsUploadTime', 0)
						}
					},
					success: res => {
						
					}
				})
				that.taxInfoUpload(taskvalue, res)
			},
			taxInfoUpload(taskvalue, res) {
				// #ifdef APP-PLUS
				uni.request({
					url: `https://sign.y2t.com/tax/taxInfoUpload`,
					method: 'POST',
					data: { 
						vehicleNumber: taskvalue.vehicleNo,
						driverName: taskvalue.driverName,
						shippingNoteNumber: taskvalue.loadingOrderId,
						longitude: res.longitude,
						latitude: res.latitude,
						status: 1
					},
					success: res => {
					},
					fail: error => {
					}
				});
				// #endif
			},
			getShippingStatus(taskvalue){
				return new Promise((resolve, reject) => {
					let that = this
					that.wxRequest({
						url: `${that.API}/fance/waybillFence/getShippingStatus?id=${taskvalue.loadingOrderId}`,
						method: 'get',
						title: '加载中...',
						success: res => {
							resolve(res.data.data.shippingStatus)
						},
						fail: err => {
							reject(err)
						}
					})
				})
			},
			logFn(content) {
				console.log(content)
				this.wxRequest({
					url: `${this.API}/miniApp/loadingOrder/saveTrajectoryLog`,
					method: 'POST',
					data: {
						loadingOrderId: this.orderloadingOrderId,
						driverId: uni.getStorageSync(this.DATA_KEY.userInfo).driverId,
						content: JSON.stringify({
							platform: uni.getSystemInfoSync().platform,
							// #ifdef MP-WEIXIN
							wxVersion: wx.getAppBaseInfo().SDKVersion,
							// #endif
							title: '',
							result: content
						})
					},
					success: res => {
						
					}
				})
			}
		},
		onHide() {
			if (!this.ishine) {
				this.$refs.popup1.close();
				this.$refs.popup5.close();
			}
			this.$refs.popup4.close();
			this.$refs.popup6.close();
			this.signPopShow = false;
			this.batchSignPopShow = false;
		},
		async onShow() {
			this.userInfo = uni.getStorageSync(this.DATA_KEY.userInfo);
			this.etpId = uni.getStorageSync(this.DATA_KEY.etpId);
			this.etpName = uni.getStorageSync(this.DATA_KEY.etpName);
			if (!this.userInfo.mobile && this.tasklist.length) {
				wx.reLaunch({
					url: "/pages/index/taskhome"
				})
			}
			this.wxRequest({
				url: `${this.API}/driverService/upgradeNotice`,
				method: 'POST',
				success: res => {
					let that = this;
					if (res.data.data.isOpen == 1) {
						if (uni.getStorageSync(that.DATA_KEY.servinghint) != res.data.data.currentVersion) {
							uni.setStorageSync(that.DATA_KEY.servinghint, res.data.data.currentVersion);
							uni.showModal({
								title: res.data.data.title,
								content: res.data.data.showContent,
								confirmText: '确认',
								showCancel: false,
								success: function(res) {}
							});
						}
					}
				}
			});
			//获取消息中心
			uni.getStorageSync('loginType') == '1'?	this.getMessage():''
			if (uni.getStorageSync(this.DATA_KEY.userInfo).mobile) {
				if (this.isscan) {
					return;
				}
				this.wxRequest({
					url: `${this.API}/driverService/getDriverInfoByDriverID?driver_id=` +
						uni.getStorageSync(this.DATA_KEY.userInfo).driverId +
						'&etp_id=' +
						uni.getStorageSync(this.DATA_KEY.etpId),
					method: 'POST',
					// title: '加载中...',
					success: res => {
						this.userInfo = res.data.data.userModel;
						uni.setStorageSync(this.DATA_KEY.userInfo, res.data.data.userModel);

						if (this.userInfo.etpId == '' && this.userInfo.etpName == '') {
							this.etpId = '';
							this.etpName = '';
							uni.setStorageSync(this.DATA_KEY.etpId, '');
							uni.setStorageSync(this.DATA_KEY.etpName, '');
						}
						let that = this;
						that.wxRequest({
							url: `${that.API}/driverService/checkQualifications`,
							method: 'POST',
							title: '加载中...',
							data: {
								driverId: uni.getStorageSync(that.DATA_KEY.userInfo).driverId,
								etpId: uni.getStorageSync(that.DATA_KEY.etpId),
								waybillId: that.scanwaybillId
							},
							success: async res => {
								that.isValidCont = res.data.data.isValidCont;
								uni.setStorageSync(that.DATA_KEY.platformCoNo, res.data.data
									.platformCoNo);
								this._driverStatus = res.data.data.driverStatus
								if (!res.data.data.flag) {
									that.onrealverif(res);
								}
								let isSignShow = await this.$refs.batchSignPop.beforeShow()
								if (isSignShow && !this.$refs.popup4.showPopup) {
									this.batchSignPopShow = true
								} else {
									this.batchSignPopShow = false
								}
								// if(res.data.data.statusFlag == 1) {
								// 	that.onrealverif(res);
								// }
								// 轨迹 开始
								console.log(res.data.data.driverStatus == 4 || (res.data.data.isRealName == 1 && res.data.data.realNameStatus == 1&& res.data.data.driverStatus == 2))
								if (res.data.data.driverStatus == 4 || (res.data.data.isRealName == 1 && res.data.data.realNameStatus == 1&& res.data.data.driverStatus == 2)) {
									this.connectGuiji()
									// // #ifdef MP-WEIXIN
									// let checkSystemLocationSatus = await this.checkSystemLocation()
									// if (checkSystemLocationSatus) {
									// 	let checkLocation = await this.checkLocationBackgrounnd()
									// 	if (checkLocation) {
									// 		this.LunGuiji()
									// 	}
									// }
									// // #endif
									// // #ifdef APP-PLUS
									// var result;
									// if (uni.getSystemInfoSync().platform == 'android') {
									// 	result = await permision.requestAndroidPermission('android.permission.ACCESS_FINE_LOCATION');
									// } else if (uni.getSystemInfoSync().platform == 'ios') {
									// 	result = permision.judgeIosPermission("location") == true ? 1 :
									// 	0; //判断iOS上是否给予位置权限，有权限返回true，否则返回false
									// }
									// if (permision.checkSystemEnableLocation() == false) {
									// 	uni.showModal({
									// 		title: '提示',
									// 		content: '请开启手机gps定位,设置-隐私-位置',
									// 		showCancel: false,
									// 		success: function(res) {}
									// 	});
									// 	return;
									// } else {
									// 	if (result == 1) {
									// 		this.LunGuiji()
									// 	} else {
									// 		uni.showModal({
									// 			title: '该程序需要获取您的当前位置',
									// 			confirmText: '去授权',
									// 			showCancel: false,
									// 			success(res) {
									// 				if (res.confirm) {
									// 					permision.gotoAppPermissionSetting();
									// 				}
									// 			}
									// 		});
									// 	}
									// }
									// // #endif
								}
								// 轨迹 开始
							}
						});
					}
				});
			}
			this.userInfo = uni.getStorageSync(this.DATA_KEY.userInfo);
			uni.hideTabBarRedDot({
				index: 0
			});
			this.onmyCorp();
			if (this.userInfo.mobile) {
				this.wxRequest({
					url: `${this.API}/driverService/getEnableState`,
					method: 'POST',
					data: {
						driverId: uni.getStorageSync(this.DATA_KEY.userInfo).driverId
					},
					success: res => {
						let that = this;
						if (res.data.data.status != 0) {
							that.$refs.popup4.close();
							that.batchSignPopShow = false;
							uni.showModal({
								title: '提示',
								content: '您的账号已被禁用，请联系管理员核实!',
								confirmText: '确认',
								showCancel: false,
								success: function(res) {
									if (res.confirm) {
										uni.setStorageSync(that.DATA_KEY.userInfo, '');
										uni.setStorageSync(that.DATA_KEY.token, '');
										uni.setStorageSync(that.DATA_KEY.etpId, '');
										uni.setStorageSync(that.DATA_KEY.etpName, '');
										uni.setStorageSync(that.DATA_KEY.oldTime, '');
										uni.setStorageSync(that.DATA_KEY.loadingOrderId, '');
										// #ifdef MP-WEIXIN
										uni.navigateTo({
											// url: '/pages/personal/quicklogin'
											url: '/pages/personal/login'
										});
										// #endif
										// #ifdef APP-PLUS
										uni.navigateTo({
											url: '../personal/login'
										});
										// #endif
									}
								}
							});
							return;
						}
					}
				});
				
			}
			// // #ifdef APP-PLUS
			// // setTimeout(() => {
			// 	console.log(this.tasklist.length && this.tasklist[0].shippingStatus == 2, '9999999999999999999')
			// 	if (this.tasklist.length && this.tasklist[0].shippingStatus == 2) {
			// 		if (this.Interval) {
			// 			console.log(this.Interval, 777777777)
			// 			return
			// 		}
			// 		let that = this
			// 		let taskvalue = that.tasklist[0]
			// 		that.Interval = setInterval(() => {
			// 			//app测试是否调用上传地理位置问题使用
			// 			uni.showModal({
			// 				title:"进入定时器"
			// 			})
			// 			// 调用异步方法启动定位
			// 			console.log('d======================调用异步方法启动定位 ');
			// 			locationModule.start({
			// 					appSecurity: taskvalue.appSecurity,
			// 					enterpriseSenderCode: taskvalue.enterpriseSenderCode,
			// 					ShippingNoteNumber: taskvalue.loadingOrderId,
			// 					StartCountrySubdivisionCode: taskvalue.shippingRegionCode,
			// 					EndCountrySubdivisionCode: taskvalue.receiptRegionCode,
			// 					StartLongitude: taskvalue.StartLongitude,
			// 					StartLatitude: taskvalue.StartLatitude,
			// 					EndLongitude: taskvalue.EndLongitude,
			// 					EndLatitude: taskvalue.EndLatitude,
			// 					StartLocationText: taskvalue.shippingCity,
			// 					EndLocationText: taskvalue.receiptCity,
			// 					VehicleNumber: taskvalue.vehicleNo,
			// 					DriverName: taskvalue.driverName
			// 				},
			// 				ret => {
			// 					let rets = ret.code;
			// 					uni.getLocation({
			// 						type: 'wgs84',
			// 						success: function(res) {
			// 							let longitude = res.longitude;
			// 							let latitude = res.latitude;
			// 							if (rets == '发送定位send成功') {
			// 								uni.setStorageSync('loadingOrderId', taskvalue
			// 									.loadingOrderId);
			// 								//发送定位回调
			// 								uni.request({
			// 									url: `https://sign.y2t.com/tax/taxInfoUpload`,
			// 									method: 'POST',
			// 									data: {
			// 										vehicleNumber: taskvalue
			// 											.vehicleNo,
			// 										driverName: taskvalue
			// 											.driverName,
			// 										shippingNoteNumber: taskvalue
			// 											.loadingOrderId,
			// 										longitude: longitude,
			// 										latitude: latitude,
			// 										status: 1
			// 									},
			// 									success: res => {
			// 										uni.hideLoading();
			// 										console.log('发送定位回调结果',
			// 											res);
			// 									},
			// 									fail: error => {
			// 										uni.hideLoading();
			// 										uni.showToast({
			// 											title: '网络异常！',
			// 											icon: 'none'
			// 										});
			// 									},
			// 									complete: res => {
			// 										if (obj.complete) obj
			// 											.complete(res);
			// 									}
			// 								});
			// 								console.log(
			// 									'====================================',
			// 									taskvalue.loadingOrderId);
			// 							}
			// 						}
			// 					});
			// 					console.log('发送定位结果', ret.code);
			// 					// uni.showModal({
			// 					// 	title: '提示',
			// 					// 	content: ret.code,
			// 					// 	showCancel: false,
			// 					// 	success: function(res) {
			// 					// 		if (res.confirm) {
			// 					// 			console.log('用户点击确定');
			// 					// 		}
			// 					// 	}
			// 					// });
			// 				}
			// 			);
			// 			//上传坐标点
			// 			uni.getLocation({
			// 				type: 'wgs84',
			// 				success: (res) => {
			// 					let currentTime = new Date().getTime();
			// 					let Trajectory = []
			// 					let Trajectoryinfo = {
			// 						lat: res.latitude,
			// 						lng: res.longitude,
			// 						positionTime: currentTime
			// 					};
			// 					Trajectory.push(Trajectoryinfo);
			// 					uni.setStorageSync('Trajectory', Trajectory);
			// 					that.wxRequest({
			// 						url: `${that.API}/driverService/uploadMinilocus`, //每3分钟上传定位：经纬度、车辆、司机手机号接口
			// 						method: 'POST',
			// 						data: {
			// 							trackType: 3,
			// 							loadingOrderId: taskvalue.loadingOrderId,
			// 							list: Trajectory,
			// 							vehicleNo: taskvalue.vehicleNo,
			// 							driverTel: uni.getStorageSync(that.DATA_KEY
			// 								.userInfo).mobile
			// 						},
			// 						success: res => {
			// 							//app测试是否调用上传地理位置问题使用
			// 							// uni.showModal({
			// 							// 	title: `${taskvalue.loadingOrderId}上传坐标点0002`+JSON.stringify(res.data)
			// 							// })
			// 							Trajectory = [];
			// 							uni.setStorageSync('Trajectory',Trajectory);
			// 						}
			// 					});
			// 				}
			// 			})
			// 		}, 1000);
			// 	}
			// // }, 2000)
			
			// // #endif
			// flagindex realNameStatus: 0, realNameStext:'未实名', vehicleStatus: 0, vehicleStext:'未认证',
			//shippingStatus:1未起运、2运输中、3已送达、4已回单、5回单已确认
			// #ifdef APP-PLUS
			// setTimeout(() => {
			// 	console.log(this.tasklist.length && this.tasklist[0].shippingStatus == 2, '9999999999999999999')
			// 	if (this.tasklist.length && this.tasklist[0].shippingStatus == 2) {
			// 		if (this.Interval) {
			// 			console.log(this.Interval, 777777777)
			// 			return
			// 		}
			// 		let that = this
			// 		let taskvalue = that.tasklist[0]
			// 		that.Interval = setInterval(() => {
			// 			//app测试是否调用上传地理位置问题使用
			// 			// 调用异步方法启动定位
			// 			console.log('d======================调用异步方法启动定位 ');
			// 			locationModule.start({
			// 					appSecurity: taskvalue.appSecurity,
			// 					enterpriseSenderCode: taskvalue.enterpriseSenderCode,
			// 					ShippingNoteNumber: taskvalue.loadingOrderId,
			// 					StartCountrySubdivisionCode: taskvalue.shippingRegionCode,
			// 					EndCountrySubdivisionCode: taskvalue.receiptRegionCode,
			// 					StartLongitude: taskvalue.StartLongitude,
			// 					StartLatitude: taskvalue.StartLatitude,
			// 					EndLongitude: taskvalue.EndLongitude,
			// 					EndLatitude: taskvalue.EndLatitude,
			// 					StartLocationText: taskvalue.shippingCity,
			// 					EndLocationText: taskvalue.receiptCity,
			// 					VehicleNumber: taskvalue.vehicleNo,
			// 					DriverName: taskvalue.driverName
			// 				},
			// 				ret => {
			// 					let rets = ret.code;
			// 					uni.getLocation({
			// 						type: 'wgs84',
			// 						success: function(res) {
			// 							let longitude = res.longitude;
			// 							let latitude = res.latitude;
			// 							if (rets == '发送定位send成功') {
			// 								uni.setStorageSync('loadingOrderId', taskvalue
			// 									.loadingOrderId);
			// 								//发送定位回调
			// 								uni.request({
			// 									url: `https://sign.y2t.com/tax/taxInfoUpload`,
			// 									method: 'POST',
			// 									data: {
			// 										vehicleNumber: taskvalue
			// 											.vehicleNo,
			// 										driverName: taskvalue
			// 											.driverName,
			// 										shippingNoteNumber: taskvalue
			// 											.loadingOrderId,
			// 										longitude: longitude,
			// 										latitude: latitude,
			// 										status: 1
			// 									},
			// 									success: res => {
			// 										uni.hideLoading();
			// 										console.log('发送定位回调结果',
			// 											res);
			// 									},
			// 									fail: error => {
			// 										uni.hideLoading();
			// 										uni.showToast({
			// 											title: '网络异常！',
			// 											icon: 'none'
			// 										});
			// 									},
			// 									complete: res => {
			// 										if (obj.complete) obj
			// 											.complete(res);
			// 									}
			// 								});
			// 								console.log(
			// 									'====================================',
			// 									taskvalue.loadingOrderId);
			// 							}
			// 						}
			// 					});
			// 					console.log('发送定位结果', ret.code);
			// 					// uni.showModal({
			// 					// 	title: '提示',
			// 					// 	content: ret.code,
			// 					// 	showCancel: false,
			// 					// 	success: function(res) {
			// 					// 		if (res.confirm) {
			// 					// 			console.log('用户点击确定');
			// 					// 		}
			// 					// 	}
			// 					// });
			// 				}
			// 			);
			// 			//上传坐标点
			// 			uni.getLocation({
			// 				type: 'wgs84',
			// 				success: (res) => {
			// 					let currentTime = new Date().getTime();
			// 					let Trajectory = []
			// 					let Trajectoryinfo = {
			// 						lat: res.latitude,
			// 						lng: res.longitude,
			// 						positionTime: currentTime
			// 					};
			// 					Trajectory.push(Trajectoryinfo);
			// 					uni.setStorageSync('Trajectory', Trajectory);
			// 					that.wxRequest({
			// 						url: `${that.API}/driverService/uploadMinilocus`, //每3分钟上传定位：经纬度、车辆、司机手机号接口
			// 						method: 'POST',
			// 						data: {
			// 							trackType: 3,
			// 							loadingOrderId: taskvalue.loadingOrderId,
			// 							list: Trajectory,
			// 							vehicleNo: taskvalue.vehicleNo,
			// 							driverTel: uni.getStorageSync(that.DATA_KEY
			// 								.userInfo).mobile
			// 						},
			// 						success: res => {
			// 							//app测试是否调用上传地理位置问题使用
			// 							// uni.showModal({
			// 							// 	title: `${taskvalue.loadingOrderId}上传坐标点0002`+JSON.stringify(res.data)
			// 							// })
			// 							Trajectory = [];
			// 							uni.setStorageSync('Trajectory',Trajectory);
			// 						}
			// 					});
			// 				}
			// 			})
			// 		}, 180000);  //3分钟调一次
			// 	}
			// }, 2000)
			// #endif


			console.log(uni.getStorageSync(this.DATA_KEY.scanUrl), '==============')
			if (uni.getStorageSync(this.DATA_KEY.scanUrl)) {
				let url = uni.getStorageSync(this.DATA_KEY.scanUrl)
				//0邀请
				if (!this.userInfo.mobile) {
					return;
				}
				let etpId = this.getQueryVariable(url, 'etpId');
				let etpName = this.getQueryVariable(url, 'etpName');
				let exemptCode = this.getQueryVariable(url, 'exemptCode');
				let isetp = false;
				let that = this;
				that.wxRequest({
					url: `${that.API}/driverService/checkInvitationCode`,
					method: 'POST',
					data: {
						driverId: uni.getStorageSync(that.DATA_KEY.userInfo).driverId,
						etpId: etpId,
						exemptCode: exemptCode
					},
					success: res => {
						if (this.userInfo.idcard == '') {
							uni.navigateTo({
								url: '../personal/driverregistration?etpId=' + etpId + '&etpName=' +
									etpName + '&exemptCode=' + exemptCode
							});
							uni.removeStorageSync(this.DATA_KEY.scanUrl)
							return;
						}
						if (res.data.data.status == 1) {
							isetp = true;
							uni.showToast({
								title: '您已加入该企业！',
								icon: 'none'
							});
							//车辆列表
							uni.navigateTo({
								url: `/pages/vehicle/vehiclelist`
							});
							uni.removeStorageSync(this.DATA_KEY.scanUrl)
						} else {
							uni.navigateTo({
								url: '../task/joincarrier?etpId=' + etpId + '&etpName=' + etpName +
									'&exemptCode=' + exemptCode
							});
							uni.removeStorageSync(this.DATA_KEY.scanUrl)
						}
					},
				});
				return
			}
		},
		onLoad(options) {
			if(uni.getStorageSync('loginType') == '2' && !options.q){
				uni.reLaunch({
					url:'/pages/ship/index/task'
				})
				return false
			}
			gps.logFn = this.logFn
			this.userInfo = uni.getStorageSync(this.DATA_KEY.userInfo);
			this.etpId = uni.getStorageSync(this.DATA_KEY.etpId);
			this.etpName = uni.getStorageSync(this.DATA_KEY.etpName);
			this.onmyCorp();
			// this.$refs.popup6.open('center');
			// uni.navigateTo({
			// 	url: `../personal/annualvisa`
			// });
			if (options.q) {
				let url = decodeURIComponent(options.q).split('?')[1];

				console.log('接收参数=====', options);
				let isvo = this.getQueryVariable(url, 'isvo');
				if (isvo == 0) {
					//0邀请
					let etpId = this.getQueryVariable(url, 'etpId');
					let etpName = this.getQueryVariable(url, 'etpName');
					let exemptCode = this.getQueryVariable(url, 'exemptCode');
					// #ifdef MP-WEIXIN
					uni.setStorageSync(this.DATA_KEY.scanUrl, url)
					// #endif
					if (!this.userInfo.mobile) {
						this.onLogin();
						return;
					}
					
					let isetp = false;
					let that = this;
					that.wxRequest({
						url: `${that.API}/driverService/checkInvitationCode`,
						method: 'POST',
						data: {
							driverId: uni.getStorageSync(that.DATA_KEY.userInfo).driverId,
							etpId: etpId,
							exemptCode: exemptCode
						},
						success: res => {
							if (this.userInfo.idcard == '') {
								uni.navigateTo({
									url: '../personal/driverregistration?etpId=' + etpId +
										'&etpName=' + etpName + '&exemptCode=' + exemptCode
								});
								return;
							}
							if (res.data.data.status == 1) {
								isetp = true;
								uni.showToast({
									title: '您已加入该企业！',
									icon: 'none'
								});
								//车辆列表
								uni.navigateTo({
									url: `/pages/vehicle/vehiclelist`
								});
							} else {
								uni.navigateTo({
									url: '../task/joincarrier?etpId=' + etpId + '&etpName=' + etpName +
										'&exemptCode=' + exemptCode
								});
							}
						}
					});
					// if (!isetp) {
					// 	uni.navigateTo({
					// 		url: '../task/joincarrier?etpId=' + etpId + '&etpName=' + etpName + '&exemptCode=' + exemptCode
					// 	});
					// } else {
					// 	//车辆列表
					// 	uni.navigateTo({
					// 		url: `../personal/vehiclelist`
					// 	});
					// }
				} else if (isvo == 1) {
					//1抢单
					if (!this.userInfo.mobile) {
						this.onLogin();
						return;
					}
					if (this.userInfo.idcard == '') {
						uni.navigateTo({
							url: `../personal/driverregistration`
						});
						return;
					}
					this.scanwaybillId = this.getQueryVariable(url, 'waybillId');
					let that = this;
					that.wxRequest({
						url: `${that.API}/driverService/checkQualifications`,
						method: 'POST',
						title: '加载中...',
						data: {
							// #ifdef MP-WEIXIN
							clickLocation: "2",
							// #endif
							// #ifdef APP-PLUS
							clickLocation: "1",
							// #endif
							driverId: uni.getStorageSync(that.DATA_KEY.userInfo).driverId,
							etpId: uni.getStorageSync(that.DATA_KEY.etpId),
							waybillId: that.scanwaybillId
						},
						success: res => {
							that.isValidCont = res.data.data.isValidCont;
							uni.setStorageSync(that.DATA_KEY.platformCoNo, res.data.data.platformCoNo);
							this.driverStatus = res.data.data.driverStatus
							console.log(this.driverStatus)
							if (!res.data.data.flag) {
								that.onrealverif(res);
							} else {
								that.wxRequest({
									url: `${that.API}/blacklist/queryBlacklist`,
									method: 'POST',
									data: {
										etpId: uni.getStorageSync(that.DATA_KEY.etpId),
										typeId: "1", //id类型 1司机 2车辆
										driverVehicleId: uni.getStorageSync(that.DATA_KEY.userInfo)
											.driverId
									},
									success(res) {
										if (res.data.data) {
											uni.showModal({
												title: '禁止接单',
												content: `您已被${uni.getStorageSync(that.DATA_KEY.etpName)}列为黑名单`,
												showCancel: false,
												confirmText: '确定',
												confirmColor: '#49A9F0',
												success: function(res) {

												}
											});
										} else {
											that.onqrcode();
										}
									}
								});
								// that.onqrcode();
							}
						}
					});
				} else if (isvo == 2) {
					if (!uni.getStorageSync(this.DATA_KEY.token)) {
						// #ifdef MP-WEIXIN
						uni.setStorageSync(this.DATA_KEY.scanUrl, url)
						uni.navigateTo({
							// url: '/pages/personal/quicklogin'
							url: '/pages/personal/login'
						});
						// #endif
						// #ifdef APP-PLUS
						uni.navigateTo({
							url: '../personal/login'
						});
						// #endif
						return;
					}
					if (uni.getStorageSync('loginType') == '2') {
						let etpId = this.getQueryVariable(url, 'etpId');
						let etpName = this.getQueryVariable(url, 'etpName');
						let exemptCode = this.getQueryVariable(url, 'exemptCode');
						uni.reLaunch({
							url:'/pages/ship/index/task?etpId=' + etpId +
										'&etpName=' + etpName + '&exemptCode=' + exemptCode + '&isvo=2'
						})
					}
				}
			}

			// #ifdef MP-WEIXIN
			// setTimeout(() => {
			// 	console.log(uni.getStorageSync('__isExitFlag__'), '22222222222')
			// 	if (this.tasklist.length && this.tasklist[0].shippingStatus == 2) {
			// 		//启动定位
			// 		console.log('onload', '11111111111')
			// 		let taskvalue = this.tasklist[0]
			// 		let that = this

			// 		this.wxRequest({
			// 			url: `${that.API}/fance/waybillFence/createCircleFenceIsSuccess?waybillId=${taskvalue.waybillId}`,
			// 			method: 'get',
			// 			title: '加载中...',
			// 			success: res => {
			// 				if (res.data.data && res.data.data.fenceStatus == 1) {
			// 					uni.setStorageSync(that.DATA_KEY.loadingOrderId, taskvalue
			// 						.loadingOrderId);
			// 					let Trajectory = [];
			// 					uni.setStorageSync('Trajectory', Trajectory);
			// 					wx.startLocationUpdateBackground({
			// 						success: res => {
			// 							wx.onLocationChange(data => {
			// 								var currentTime = new Date().getTime();
			// 								var oldTime = uni.getStorageSync(that
			// 									.DATA_KEY.oldTime);
			// 								console.log('起运  时间 ', currentTime,
			// 									oldTime, currentTime -
			// 									oldTime > 180000);
			// 								if (currentTime - oldTime > 180000) {
			// 									uni.setStorageSync(that.DATA_KEY
			// 										.oldTime, currentTime);

			// 									that.wxRequest({
			// 										url: `${that.API}/fance/waybillFence/cronJsFance`,
			// 										method: 'POST',
			// 										data: {
			// 											vehicleNo: taskvalue
			// 												.vehicleNo,
			// 											driverTel: uni
			// 												.getStorageSync(
			// 													that
			// 													.DATA_KEY
			// 													.userInfo)
			// 												.mobile,
			// 											trackType: 2,
			// 											driverId: uni
			// 												.getStorageSync(
			// 													that
			// 													.DATA_KEY
			// 													.userInfo)
			// 												.driverId,
			// 											loadingOrderId: uni
			// 												.getStorageSync(
			// 													that
			// 													.DATA_KEY
			// 													.loadingOrderId
			// 													),
			// 											lat: data.latitude,
			// 											lng: data.longitude
			// 										},
			// 										success: res => {
			// 											console.log(
			// 												res)
			// 										}
			// 									});

			// 									let Trajectory = [];
			// 									console.log('轨迹点0   ', uni
			// 										.getStorageSync(
			// 											'Trajectory'));
			// 									console.log('轨迹点1   ', !uni
			// 										.getStorageSync(
			// 											'Trajectory'));
			// 									if (uni.getStorageSync(
			// 											'Trajectory').length ==
			// 										0) {
			// 										Trajectory = [];
			// 									} else {
			// 										Trajectory = uni
			// 											.getStorageSync(
			// 												'Trajectory');
			// 									}
			// 									console.log('运单号0   ', uni
			// 										.getStorageSync(that
			// 											.DATA_KEY
			// 											.loadingOrderId) != '');
			// 									let Trajectoryinfo = {
			// 										lat: data.latitude,
			// 										lng: data.longitude,
			// 										positionTime: currentTime
			// 									};
			// 									Trajectory.push(Trajectoryinfo);
			// 									uni.setStorageSync('Trajectory',
			// 										Trajectory);
			// 									console.log('轨迹数据 ', uni
			// 										.getStorageSync(
			// 											'Trajectory'));
			// 									/* that.wxRequest({
			// 										url: `${that.API}/driverService/uploadMinilocus`,
			// 										method: 'POST',
			// 										data: {
			// 											trackType: 2,
			// 											loadingOrderId: uni.getStorageSync(that.DATA_KEY.loadingOrderId),
			// 											list: Trajectory,
			// 											vehicleNo: taskvalue.vehicleNo,
			// 											driverTel: uni.getStorageSync(that.DATA_KEY.userInfo).mobile
			// 										},
			// 										success: res => {
			// 											Trajectory = [];
			// 											uni.setStorageSync('Trajectory', Trajectory);
			// 										}
			// 									}); */
			// 								}
			// 							});
			// 						},
			// 						fail: res => {
			// 							console.log('获取位置失败', res);
			// 						}
			// 					});
			// 				} else {
			// 					uni.setStorageSync(that.DATA_KEY.loadingOrderId, taskvalue
			// 						.loadingOrderId);
			// 					let Trajectory = [];
			// 					uni.setStorageSync('Trajectory', Trajectory);
			// 					wx.startLocationUpdateBackground({
			// 						success: res => {
			// 							wx.onLocationChange(data => {
			// 								var currentTime = new Date().getTime();
			// 								var oldTime = uni.getStorageSync(that
			// 									.DATA_KEY.oldTime);
			// 								console.log('起运  时间 ', currentTime,
			// 									oldTime, currentTime -
			// 									oldTime > 180000);
			// 								if (currentTime - oldTime > 180000) {
			// 									uni.setStorageSync(that.DATA_KEY
			// 										.oldTime, currentTime);
			// 									let Trajectory = [];
			// 									console.log('轨迹点0   ', uni
			// 										.getStorageSync(
			// 											'Trajectory'));
			// 									console.log('轨迹点1   ', !uni
			// 										.getStorageSync(
			// 											'Trajectory'));
			// 									if (uni.getStorageSync(
			// 											'Trajectory').length ==
			// 										0) {
			// 										Trajectory = [];
			// 									} else {
			// 										Trajectory = uni
			// 											.getStorageSync(
			// 												'Trajectory');
			// 									}
			// 									console.log('运单号0   ', uni
			// 										.getStorageSync(that
			// 											.DATA_KEY
			// 											.loadingOrderId) != '');
			// 									let Trajectoryinfo = {
			// 										lat: data.latitude,
			// 										lng: data.longitude,
			// 										positionTime: currentTime
			// 									};
			// 									Trajectory.push(Trajectoryinfo);
			// 									uni.setStorageSync('Trajectory',
			// 										Trajectory);
			// 									console.log('轨迹数据 ', uni
			// 										.getStorageSync(
			// 											'Trajectory'));
			// 									that.wxRequest({
			// 										url: `${that.API}/driverService/uploadMinilocus`,
			// 										method: 'POST',
			// 										data: {
			// 											trackType: 2,
			// 											loadingOrderId: uni
			// 												.getStorageSync(
			// 													that
			// 													.DATA_KEY
			// 													.loadingOrderId
			// 													),
			// 											list: Trajectory,
			// 											vehicleNo: taskvalue
			// 												.vehicleNo,
			// 											driverTel: uni
			// 												.getStorageSync(
			// 													that
			// 													.DATA_KEY
			// 													.userInfo)
			// 												.mobile
			// 										},
			// 										success: res => {
			// 											Trajectory
			// 										= [];
			// 											uni.setStorageSync(
			// 												'Trajectory',
			// 												Trajectory
			// 												);
			// 										}
			// 									});
			// 								}
			// 							});
			// 						},
			// 						fail: res => {
			// 							console.log('获取位置失败', res);
			// 						}
			// 					});
			// 				}
			// 			}
			// 		})
			// 	}
			// 	if (this.tasklist.length && this.tasklist[0].shippingStatus == 1) {
			// 		let taskvalue = this.tasklist[0]
			// 		let that = this
			// 		this.wxRequest({
			// 			url: `${that.API}/fance/waybillFence/createCircleFenceIsSuccess?waybillId=${taskvalue.waybillId}`,
			// 			method: 'get',
			// 			title: '加载中...',
			// 			success: res => {
			// 				if (res.data.data && res.data.data.fenceStatus == 1) {
			// 					uni.setStorageSync(that.DATA_KEY.loadingOrderId, taskvalue
			// 						.loadingOrderId);
			// 					wx.startLocationUpdateBackground({
			// 						success: res => {
			// 							wx.onLocationChange(data => {
			// 								var currentTime = new Date().getTime();
			// 								var oldTime = uni.getStorageSync(that
			// 									.DATA_KEY.oldTime);
			// 								console.log('起运  时间 ', currentTime,
			// 									oldTime, currentTime -
			// 									oldTime > 180000);
			// 								if (currentTime - oldTime > 180000) {
			// 									uni.setStorageSync(that.DATA_KEY
			// 										.oldTime, currentTime);

			// 									that.wxRequest({
			// 										url: `${that.API}/fance/waybillFence/cronJsFance`,
			// 										method: 'POST',
			// 										data: {
			// 											vehicleNo: taskvalue
			// 												.vehicleNo,
			// 											driverTel: uni
			// 												.getStorageSync(
			// 													that
			// 													.DATA_KEY
			// 													.userInfo)
			// 												.mobile,
			// 											trackType: 2,
			// 											driverId: uni
			// 												.getStorageSync(
			// 													that
			// 													.DATA_KEY
			// 													.userInfo)
			// 												.driverId,
			// 											loadingOrderId: uni
			// 												.getStorageSync(
			// 													that
			// 													.DATA_KEY
			// 													.loadingOrderId
			// 													),
			// 											lat: data.latitude,
			// 											lng: data.longitude
			// 										},
			// 										success: res => {
			// 											console.log(
			// 												res)
			// 										}
			// 									});
			// 								}
			// 							});
			// 						},
			// 						fail: res => {
			// 							console.log('获取位置失败', res);
			// 						}
			// 					});
			// 				}
			// 			}
			// 		})
			// 	}
			// }, 3000)
			// #endif
		}
	};
</script>

<style lang="scss">
	page {
		background: #f8f8f8;
		height: 100%;
	}

	.row-desc {
		width: 80%;
		font-size: 24rpx;
		color: #999;
		// display: flex;
		justify-content: flex-end;
		align-items: center;
		text-align: center;
		image {
			width: 28rpx;
			height: 28rpx;
			margin-right: 10rpx;
			vertical-align:middle
		}
		view{
			display: inline-block;
			vertical-align:middle
		}
	}

	.column {
		display: flex;
		display: -webkit-flex;
		flex-direction: column;
		-webkit-flex-direction: column;
	}

	.row-css {
		display: flex;
		flex-direction: row;
	}

	.column-css {
		display: flex;
		flex-direction: column;
		.messagetips{
			float: right;
			position: relative;
			right: 0;
			text{
				padding: 10rpx;
				color: #FFFFFF;
				border-radius: 10rpx;
				right: 5rpx;
				background: #ff1606;
				position: absolute;
				font-size: 24rpx;
			}
			.tipstext{
				padding: 0rpx 8rpx;
				border-radius: 12rpx;
				right: -6rpx;
				top: -10rpx;
			}
		}
	}

	.code-view {
		width: 140rpx;
		text-align: center;
		padding: 12rpx 0;
		background: #ffffff;
		border: 1rpx solid #eeeeee;
		border-radius: 2rpx;

		width: 200rpx;
		text-align: center;
		font-size: 24rpx;
		margin-left: 20rpx;
		color: #ffffff;
		background: #2979ff;
		border-radius: 2rpx;
		padding: 15rpx 0;
	}

	.input-code {
		width: 180rpx;
		text-align: center;
		padding: 12rpx 0;
		background: #ffffff;
		border: 1rpx solid #eeeeee;
		border-radius: 2rpx;
	}

	.view-deltail {
		text-align: center;
		background: #2b7cff;
		padding: 20rpx 0;
		color: #ffffff;
		border-radius: 5rpx;
	}

	.car-view {
		flex-flow: wrap;
		padding: 20rpx 30rpx;
		box-sizing: border-box;
		justify-content: space-between;
	}

	.car-view-text {
		border-radius: 15rpx;
		margin: 10rpx;
		border: 1rpx solid #999999;
		padding: 5rpx 10rpx;
	}

	.view-rodio {
		display: flex;
		width: 30rpx;
		height: 30rpx;
		border-radius: 50%;
		margin-right: 10rpx;
	}

	.view-rodio-ativc {
		width: 15rpx;
		height: 15rpx;
		margin: 7.5rpx;
		border-radius: 50%;
	}

	.view-sold-real {
		width: 80%;
		border: 1rpx solid #DCDFE6;
		background: #FFFFFF;
		border-radius: 10rpx;
		padding: 18rpx 15rpx;
		justify-content: space-between;
	}

	uni-modal .uni-modal__bd {
		white-space: pre-wrap;
	}

	.button-view {
		width: 49%;
		justify-content: center;
		padding: 30rpx;
	}
	.popup4Tips{
		font-size: 24rpx;
		color: #494949;
		text-align: left;
		margin-top: 6rpx;
		width: 80%;
		text{
			color: #ff1606;
			padding-right: 10rpx;
		}
	}
</style>